Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2008 Daniel Spiewak
  * 
  * Licensed under the Apache License, Version 2.0 (the "License"); 
  * you may not use this file except in compliance with the License. 
  * You may obtain a copy of the License at
  * 
  *	    http://www.apache.org/licenses/LICENSE-2.0 
  * 
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.java.ao;
import static com.google.common.base.Preconditions.*;

WARNING: Not part of the public API. This class is public only to allow its use within other packages in the ActiveObjects library.

public final class AnnotationDelegate
    private final Method method1method2;
    public AnnotationDelegate(Method method1Method method2)
    {
        this. = checkNotNull(method1);
        this. = method2;
    }

    
Returns the annotation for the specified methods starting by method1.

Parameters:
annotationClass the annotation type to look up
Returns:
this element's annotation for the specified annotation type if present on any of the methods, else null
See also:
java.lang.reflect.Method.getAnnotation(java.lang.Class)
    public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
    {
        final T a = .getAnnotation(annotationClass);
        if (a != null)
        {
            return a;
        }
        return  == null ? null : .getAnnotation(annotationClass);
    }

    
Returns true if an annotation for the specified type is present on any of the methods, else false. This method is designed primarily for convenient access to marker annotations.

Parameters:
annotationClass the Class object corresponding to the annotation type
Returns:
true if an annotation for the specified annotation type is present on any of the methods, else false
    public boolean isAnnotationPresent(Class<? extends AnnotationannotationClass)
    {
        return .isAnnotationPresent(annotationClass) || ( != null && .isAnnotationPresent(annotationClass));
    }
New to GrepCode? Check out our FAQ X