+
+ def protected generateCheckers(GeneratedProperty field, Restrictions restrictions, Type actualType) '''
+ «IF restrictions.rangeConstraint.present»
+ «AbstractRangeGenerator.forType(actualType).generateRangeChecker(field.name.toFirstUpper,
+ restrictions.rangeConstraint.get, this)»
+ «ENDIF»
+ «IF restrictions.lengthConstraint.present»
+ «LengthGenerator.generateLengthChecker(field.fieldName, actualType, restrictions.lengthConstraint.get, this)»
+ «ENDIF»
+ '''
+
+ def protected checkArgument(GeneratedProperty property, Restrictions restrictions, Type actualType, String value) '''
+ «IF restrictions.getRangeConstraint.isPresent»
+ «IF actualType instanceof ConcreteType»
+ «AbstractRangeGenerator.forType(actualType).generateRangeCheckerCall(property.getName.toFirstUpper, value)»
+ «ELSE»
+ «AbstractRangeGenerator.forType(actualType).generateRangeCheckerCall(property.getName.toFirstUpper, value + ".getValue()")»
+ «ENDIF»
+ «ENDIF»
+ «val fieldName = property.fieldName»
+ «IF restrictions.getLengthConstraint.isPresent»
+ «IF actualType instanceof ConcreteType»
+ «LengthGenerator.generateLengthCheckerCall(fieldName, value)»
+ «ELSE»
+ «LengthGenerator.generateLengthCheckerCall(fieldName, value + ".getValue()")»
+ «ENDIF»
+ «ENDIF»
+
+ «val fieldUpperCase = fieldName.toUpperCase(Locale.ENGLISH)»
+ «FOR currentConstant : type.getConstantDefinitions»
+ «IF currentConstant.getName.startsWith(TypeConstants.PATTERN_CONSTANT_NAME)
+ && fieldUpperCase.equals(currentConstant.getName.substring(TypeConstants.PATTERN_CONSTANT_NAME.length))»
+ «CODEHELPERS.importedName».checkPattern(value, «Constants.MEMBER_PATTERN_LIST»«fieldName», «Constants.MEMBER_REGEX_LIST»«fieldName»);
+ «ENDIF»
+ «ENDFOR»
+ '''
+
+ def protected hashCodeResult(Collection<? extends GeneratedProperty> properties) '''
+ final int prime = 31;
+ int result = 1;
+ «FOR property : properties»
+ result = prime * result + «property.importedUtilClass».hashCode(«property.fieldName»);
+ «ENDFOR»
+ '''
+
+ def protected final generateAnnotation(AnnotationType annotation) '''
+ @«annotation.importedName»
+ «IF annotation.parameters !== null && !annotation.parameters.empty»
+ (
+ «FOR param : annotation.parameters SEPARATOR ","»
+ «param.name»=«param.value»
+ «ENDFOR»
+ )
+ «ENDIF»
+ '''