/** * Constructor. * * @param ownerType the type of the owner class * @param logger */ public OwnerClass(JClassType ownerType, MortalLogger logger, UiBinderContext context) throws UnableToCompleteException { this.logger = logger; this.ownerType = ownerType; this.context = context; findUiFields(ownerType); findUiFactories(ownerType); findUiHandlers(ownerType); }
/** * Constructor. * * @param ownerType the type of the owner class * @param logger */ public OwnerClass(JClassType ownerType, MortalLogger logger, UiBinderContext context) throws UnableToCompleteException { this.logger = logger; this.ownerType = ownerType; this.context = context; findUiFields(ownerType); findUiFactories(ownerType); findUiHandlers(ownerType); }
/** * Scans the owner class to find all fields annotated with @UiField, and puts * them in {@link #uiFields} and {@link #uiFieldTypes}. * * @param ownerType the type of the owner class */ private void findUiFields(JClassType ownerType) throws UnableToCompleteException { JField[] fields = ownerType.getFields(); for (JField field : fields) { if (field.isAnnotationPresent(UiField.class)) { JClassType ownerFieldType = field.getType().isClassOrInterface(); if (ownerFieldType == null) { logger.die("Field type is not a class in field " + field.getName()); } OwnerField ownerField = new OwnerField(field, logger, context); String ownerFieldName = field.getName(); uiFields.put(ownerFieldName, ownerField); uiFieldTypes.put(ownerFieldType, ownerField); } } // Recurse to superclass JClassType superclass = ownerType.getSuperclass(); if (superclass != null) { findUiFields(superclass); } }
/** * Scans the owner class to find all fields annotated with @UiField, and puts * them in {@link #uiFields} and {@link #uiFieldTypes}. * * @param ownerType the type of the owner class */ private void findUiFields(JClassType ownerType) throws UnableToCompleteException { JField[] fields = ownerType.getFields(); for (JField field : fields) { if (field.isAnnotationPresent(UiField.class)) { JClassType ownerFieldType = field.getType().isClassOrInterface(); if (ownerFieldType == null) { logger.die("Field type is not a class in field " + field.getName()); } OwnerField ownerField = new OwnerField(field, logger, context); String ownerFieldName = field.getName(); uiFields.put(ownerFieldName, ownerField); uiFieldTypes.put(ownerFieldType, ownerField); } } // Recurse to superclass JClassType superclass = ownerType.getSuperclass(); if (superclass != null) { findUiFields(superclass); } }