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

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

Introduction

In this page you can find the example usage for com.google.gwt.core.ext.typeinfo JConstructor 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:fr.onevu.gwt.uibinder.rebind.model.OwnerFieldClass.java

License:Apache License

/**
 * Finds the constructor annotated with @UiConcontructor if there is one, and
 * puts it in the {@link #uiConstructor} field.
 * /*  w  w  w. j av a 2  s  .com*/
 * @param fieldType
 *          the type of the field
 */
private void findUiConstructor(JClassType fieldType) throws UnableToCompleteException {
    for (JConstructor ctor : fieldType.getConstructors()) {
        if (ctor.getAnnotation(UiConstructor.class) != null) {
            if (uiConstructor != null) {
                logger.die(
                        fieldType.getName() + " has more than one constructor annotated with @UiConstructor");
            }
            uiConstructor = ctor;
        }
    }
}