Package org.gwtoolbox.commons.generator.rebind

Examples of org.gwtoolbox.commons.generator.rebind.AnnotationWrapper


            writer.println("static {");
            String typeName = attributesType.getName();
            String varName = "attributes_" + (i++);
            writer.println("    " + typeName + " " + varName + " = new " + typeName + "();");
            AnnotationWrapper wrapper = new AnnotationWrapper(annotation);
            for (String attributeName : wrapper.getAttributeNames()) {
                Object value = wrapper.getValue(attributeName);
                String valueText = String.valueOf(value);
                if (String.class.isInstance(value)) {
                    valueText = "\"" + valueText + "\"";
                } else if (Enum.class.isInstance(value)) {
                    valueText = value.getClass().getName() + "." + ((Enum) value).name();
View Full Code Here


    private Set<Class<? extends Payload>> payload;

    public ConstraintDefinition(Annotation annotation, JType type) {
        Class propertyClass = GeneratorUtils.loadClass(type);
        Class<? extends Annotation> annotationType = annotation.annotationType();
        AnnotationWrapper wrapper = new AnnotationWrapper(annotation);
        attributes = new AnnotationAttributes(annotation);

        groups = createClassSet((Class[]) wrapper.getValue("groups"));
        if (groups.isEmpty()) {
            groups.add(Default.class);
        }
        groups = GroupUtils.expandGroups(groups);

        payload = createClassSet((Class[]) wrapper.getValue("payload"));

        message = new Message(wrapper.getString("message"));

        // resolving the validator class
        Constraint  constraint = annotationType.getAnnotation(Constraint.class);
        Class<? extends ConstraintValidator<?, ?>>[] validatorClasses = constraint.validatedBy();
        if (validatorClasses.length == 0) {
View Full Code Here

public class AnnotationAttributes implements Attributes {

    private final AnnotationWrapper wrapper;

    public AnnotationAttributes(Annotation annotation) {
        wrapper = new AnnotationWrapper(annotation);
    }
View Full Code Here

            }

            // now we're looking for a list annotation. According to the specs the list annotation should only have
            // a value attribute of an array type where the components of the array are annotations marked with the @Constraint
            // annotation
            AnnotationWrapper wrapper = new AnnotationWrapper(annotation);
            if (!wrapper.getAttributeNames().contains("value")) {
                continue;
            }
            Object value = wrapper.getValue("value");
            if (!value.getClass().isArray()) {
                continue;
            }
            Class subAnnotationType = value.getClass().getComponentType();
            if (!subAnnotationType.isAnnotation()) {
View Full Code Here

        this.logger = logger;
    }

    public final void init(T t, JClassType containerType, GeneratorContext context) throws ProcessorInitializationException {
        EasyTreeLogger newLogger = logger.branchInfo("Initializing processor '" + getClass().getName() + "'...");
        order = new AnnotationWrapper(t).getInt("order", order);
        if (newLogger.debugEnabled()) {
            newLogger.debug("Order: " + order);
        }
        doInit(newLogger, t, containerType, context);
    }
View Full Code Here

TOP

Related Classes of org.gwtoolbox.commons.generator.rebind.AnnotationWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.