001/* -*- mode: Java; c-basic-offset: 2; indent-tabs-mode: nil; coding: utf-8-unix -*- 002 * 003 * Copyright © 2025 microBean™. 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with 006 * the License. You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 011 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 012 * specific language governing permissions and limitations under the License. 013 */ 014package org.microbean.producer; 015 016import java.util.Collection; 017 018import org.microbean.interceptor.InterceptorMethod; 019 020/** 021 * A collection of {@link InterceptorMethod}s indexed by {@link InterceptorMethodType}. 022 * 023 * @author <a href="https://about.me/lairdnelson" target="_top">Laird Nelson</a> 024 */ 025public interface Interceptor extends AutoCloseable { 026 027 /** 028 * Closes this {@link Interceptor}, rendering it inappropriate for further use. 029 * 030 * <p>The default implementation of this method does nothing.</p> 031 */ 032 @Override // AutoCloseable 033 public default void close() { 034 035 } 036 037 /** 038 * Returns a non-{@code null}, immutable, determinate {@link Collection} of {@link InterceptorMethod}s indexed under 039 * the supplied {@link InterceptorMethodType}. 040 * 041 * @param type an {@link InterceptorMethodType}; must not be {@code null} 042 * 043 * @return a non-{@code null}, immutable, determinate {@link Collection} of {@link InterceptorMethod}s indexed under 044 * the supplied {@link InterceptorMethodType} 045 * 046 * @exception NullPointerException if {@code type} is {@code null} 047 */ 048 // "Give me the @AroundInvoke interceptor methods that are bound to the interceptor binding set that I am attributed 049 // with" 050 // 051 // Interceptor bindings must be at the class level and will therefore apply to all interceptor methods. 052 public Collection<? extends InterceptorMethod> interceptorMethods(final InterceptorMethodType type); 053 054}