Example usage for com.google.gwt.core.ext.typeinfo HasAnnotations getAnnotation

List of usage examples for com.google.gwt.core.ext.typeinfo HasAnnotations getAnnotation

Introduction

In this page you can find the example usage for com.google.gwt.core.ext.typeinfo HasAnnotations getAnnotation.

Prototype

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

Source Link

Document

Returns an instance of the specified annotation type if it is present on this element or null if it is not.

Usage

From source file:cc.alcina.framework.entity.gwtsynth.ClientReflectionGenerator.java

License:Apache License

private List<Annotation> getVisibleAnnotations(HasAnnotations ha,
        List<Class<? extends Annotation>> annotationClasses) {
    List<Annotation> result = new ArrayList<Annotation>();
    for (Class<? extends Annotation> a : annotationClasses) {
        if (ha.isAnnotationPresent(a)) {
            result.add(ha.getAnnotation(a));
        }//from  ww  w. j a  v  a 2 s  . c  o  m
    }
    return result;
}

From source file:com.github.nmorel.gwtjackson.rebind.CreatorUtils.java

License:Apache License

/**
 * Returns the first occurence of the annotation found on the types
 *
 * @param annotation the annotation// www .j a  v  a  2  s  .  c  o  m
 * @param hasAnnotationsList the types
 * @param <T> Type of the annotation
 *
 * @return the first occurence of the annotation found on the types
 */
public static <T extends Annotation> Optional<T> getAnnotation(Class<T> annotation,
        List<? extends HasAnnotations> hasAnnotationsList) {
    for (HasAnnotations accessor : hasAnnotationsList) {
        if (accessor.isAnnotationPresent(annotation)) {
            return Optional.of(accessor.getAnnotation(annotation));
        }
    }
    return Optional.absent();
}

From source file:com.gwtent.gen.reflection.ReflectAllInOneCreator.java

License:Apache License

private boolean hasReflection(HasAnnotations type) {
    return type.getAnnotation(HasReflect.class) != null;
}

From source file:com.gwtent.gen.reflection.ReflectAllInOneCreator.java

License:Apache License

private boolean hasReflectionAnnotation(HasAnnotations type) {
    return (type.getAnnotation(HasReflect.class) != null) && type.getAnnotation(HasReflect.class).annotation();
}

From source file:com.gwtplatform.dispatch.rest.rebind.parameter.CookieParamValueResolver.java

License:Apache License

@Override
public String resolve(HasAnnotations hasAnnotations) {
    return resolve(hasAnnotations.getAnnotation(CookieParam.class));
}

From source file:com.gwtplatform.dispatch.rest.rebind.parameter.FormParamValueResolver.java

License:Apache License

@Override
public String resolve(HasAnnotations hasAnnotations) {
    return resolve(hasAnnotations.getAnnotation(FormParam.class));
}

From source file:com.gwtplatform.dispatch.rest.rebind.parameter.HeaderParamValueResolver.java

License:Apache License

@Override
public String resolve(HasAnnotations hasAnnotations) {
    return resolve(hasAnnotations.getAnnotation(HeaderParam.class));
}

From source file:com.gwtplatform.dispatch.rest.rebind.parameter.MatrixParamValueResolver.java

License:Apache License

@Override
public String resolve(HasAnnotations hasAnnotations) {
    return resolve(hasAnnotations.getAnnotation(MatrixParam.class));
}

From source file:com.gwtplatform.dispatch.rest.rebind.parameter.PathParamValueResolver.java

License:Apache License

@Override
public String resolve(HasAnnotations hasAnnotations) {
    return resolve(hasAnnotations.getAnnotation(PathParam.class));
}

From source file:com.gwtplatform.dispatch.rest.rebind.parameter.QueryParamValueResolver.java

License:Apache License

@Override
public String resolve(HasAnnotations hasAnnotations) {
    return resolve(hasAnnotations.getAnnotation(QueryParam.class));
}