Example usage for java.lang.reflect AccessibleObject getAnnotation

List of usage examples for java.lang.reflect AccessibleObject getAnnotation

Introduction

In this page you can find the example usage for java.lang.reflect AccessibleObject getAnnotation.

Prototype

public <T extends Annotation> T getAnnotation(Class<T> annotationClass) 

Source Link

Usage

From source file:org.mule.module.extension.internal.util.IntrospectionUtils.java

public static boolean isRequired(AccessibleObject object) {
    return object.getAnnotation(Optional.class) == null;
}

From source file:org.mule.module.extension.internal.util.IntrospectionUtils.java

public static boolean isDynamic(AccessibleObject object) {
    org.mule.extension.annotations.Parameter parameter = object
            .getAnnotation(org.mule.extension.annotations.Parameter.class);
    return parameter != null ? parameter.isDynamic() : true;
}

From source file:org.openspaces.core.context.GigaSpaceContextBeanPostProcessor.java

private void addIfPresent(List<AnnotatedMember> metadata, AccessibleObject ao) {
    GigaSpaceContext gsContext = ao.getAnnotation(GigaSpaceContext.class);
    if (gsContext != null) {
        metadata.add(new AnnotatedMember(gsContext.name(), ao));
    }/* w w  w . java2 s . c  o m*/
}

From source file:org.openspaces.core.context.GigaSpaceLateContextBeanFactoryPostProcessor.java

private void addIfPresent(List<AnnotatedMember> metadata, AccessibleObject ao) {
    GigaSpaceLateContext gsContext = ao.getAnnotation(GigaSpaceLateContext.class);
    if (gsContext != null) {
        metadata.add(new AnnotatedMember(gsContext.name(), ao));
    }//from w  w  w .  ja v a 2s. co m
}

From source file:org.zanata.client.BashCompletionGenerator.java

private static List<Option> getOptions(Class<?> bean) {
    ImmutableList.Builder<Option> allOptions = ImmutableList.builder();
    // recursively process all the methods/fields.
    for (Class<?> c = bean; c != null; c = c.getSuperclass()) {
        ImmutableList.Builder<AccessibleObject> builder = ImmutableList.builder();
        List<AccessibleObject> fieldAndMethods = builder.add(c.getDeclaredFields()).add(c.getDeclaredMethods())
                .build();// w w  w. j a v a 2 s  . co  m
        for (AccessibleObject accessibleObject : fieldAndMethods) {
            Option option = accessibleObject.getAnnotation(Option.class);
            if (option != null) {
                allOptions.add(option);
            }
        }
    }
    return allOptions.build();
}