BaseRuntimeDeclaredChildDefinition(Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName) throws ConfigurationException { super(); Validate.notNull(theField, "No field speficied"); ValidateUtil.isGreaterThanOrEqualTo(theChildAnnotation.min(), 0, "Min must be >= 0"); Validate.isTrue(theChildAnnotation.max() == -1 || theChildAnnotation.max() >= theChildAnnotation.min(), "Max must be >= Min (unless it is -1 / unlimited)"); Validate.notBlank(theElementName, "Element name must not be blank"); myField = theField; myMin = theChildAnnotation.min(); myMax = theChildAnnotation.max(); mySummary = theChildAnnotation.summary(); myModifier = theChildAnnotation.modifier(); myElementName = theElementName; if (theDescriptionAnnotation != null) { myShortDefinition = theDescriptionAnnotation.shortDefinition(); myFormalDefinition = theDescriptionAnnotation.formalDefinition(); } else { myShortDefinition = null; myFormalDefinition = null; } myField.setAccessible(true); if (List.class.equals(myField.getType())) { // TODO: verify that generic type is IElement myAccessor = new FieldListAccessor(); myMutator = new FieldListMutator(); } else { myAccessor = new FieldPlainAccessor(); myMutator = new FieldPlainMutator(); } }
BaseRuntimeDeclaredChildDefinition(Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName) throws ConfigurationException { super(); Validate.notNull(theField, "No field speficied"); ValidateUtil.isGreaterThanOrEqualTo(theChildAnnotation.min(), 0, "Min must be >= 0"); Validate.isTrue(theChildAnnotation.max() == -1 || theChildAnnotation.max() >= theChildAnnotation.min(), "Max must be >= Min (unless it is -1 / unlimited)"); Validate.notBlank(theElementName, "Element name must not be blank"); myField = theField; myMin = theChildAnnotation.min(); myMax = theChildAnnotation.max(); mySummary = theChildAnnotation.summary(); myModifier = theChildAnnotation.modifier(); myElementName = theElementName; if (theDescriptionAnnotation != null) { myShortDefinition = theDescriptionAnnotation.shortDefinition(); myFormalDefinition = theDescriptionAnnotation.formalDefinition(); } else { myShortDefinition = null; myFormalDefinition = null; } myField.setAccessible(true); if (List.class.equals(myField.getType())) { // TODO: verify that generic type is IElement myAccessor = new FieldListAccessor(); myMutator = new FieldListMutator(); } else { myAccessor = new FieldPlainAccessor(); myMutator = new FieldPlainMutator(); } }