Class Validator
- java.lang.Object
-
- org.jboss.logging.processor.validation.Validator
-
public final class Validator extends java.lang.ObjectDate: 12.08.2011
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Collection<java.lang.String>AVAILABLE_LANGUAGESprivate javax.lang.model.util.Elementselementsprivate IdLengthValidatoridLengthValidatorprivate IdRangeValidatoridRangeValidatorprivate MessageIdValidatormessageIdValidatorprivate javax.annotation.processing.ProcessingEnvironmentprocessingEnvprivate javax.lang.model.util.Typestypes
-
Constructor Summary
Constructors Constructor Description Validator(javax.annotation.processing.ProcessingEnvironment processingEnv)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.Set<MessageMethod>getAllMethods(MessageInterface messageInterface)Finds all methods for the given interface, but ignores logger interface methods.private booleanisTypeAssignableFrom(javax.lang.model.element.Element element, java.lang.Class<?> type)Checks the element type, if an array the type of the array is checked, against the class.private booleanisTypeAssignableFrom(javax.lang.model.type.TypeMirror typeMirror, java.lang.Class<?> type)Checks the type, if an array the type of the array is checked, against the class.private booleanisTypeAssignableFrom(javax.lang.model.type.TypeMirror typeMirror, javax.lang.model.type.TypeMirror type)Checks the type, if an array the type of the array is checked, against the class.java.util.Collection<ValidationMessage>validate(MessageInterface messageInterface)Validates the message interface and returns a collection of validation messages or an empty collection.private java.util.Collection<ValidationMessage>validateBundle(java.util.Set<MessageMethod> messageMethods)Validate message bundle messageMethods.private java.util.Collection<ValidationMessage>validateBundleMethod(MessageMethod messageMethod)private java.util.Collection<ValidationMessage>validateCommon(MessageInterface messageInterface, java.util.Set<MessageMethod> messageMethods)Validate common attributes to all interfaces.private java.util.Collection<ValidationMessage>validateLogger(java.util.Set<MessageMethod> messageMethods)Validate message logger messageMethods.private java.util.Collection<ValidationMessage>validateLoggerMethod(MessageMethod messageMethod)private java.util.Collection<ValidationMessage>validateParameters(MessageMethod messageMethod)private voidvalidateTransform(java.util.List<ValidationMessage> messages, Parameter parameter, Transform transform)
-
-
-
Field Detail
-
AVAILABLE_LANGUAGES
private static final java.util.Collection<java.lang.String> AVAILABLE_LANGUAGES
-
messageIdValidator
private final MessageIdValidator messageIdValidator
-
idLengthValidator
private final IdLengthValidator idLengthValidator
-
idRangeValidator
private final IdRangeValidator idRangeValidator
-
processingEnv
private final javax.annotation.processing.ProcessingEnvironment processingEnv
-
elements
private final javax.lang.model.util.Elements elements
-
types
private final javax.lang.model.util.Types types
-
-
Method Detail
-
validate
public final java.util.Collection<ValidationMessage> validate(MessageInterface messageInterface)
Validates the message interface and returns a collection of validation messages or an empty collection.- Parameters:
messageInterface- the message interface to validate.- Returns:
- a collection of validation messages or an empty collection.
-
validateCommon
private java.util.Collection<ValidationMessage> validateCommon(MessageInterface messageInterface, java.util.Set<MessageMethod> messageMethods)
Validate common attributes to all interfaces.- Parameters:
messageInterface- the interface.messageMethods- the messageMethods to validate.- Returns:
- a collection of validation messages.
-
validateTransform
private void validateTransform(java.util.List<ValidationMessage> messages, Parameter parameter, Transform transform)
-
validateParameters
private java.util.Collection<ValidationMessage> validateParameters(MessageMethod messageMethod)
-
validateBundle
private java.util.Collection<ValidationMessage> validateBundle(java.util.Set<MessageMethod> messageMethods)
Validate message bundle messageMethods.- Parameters:
messageMethods- the messageMethods to validate.- Returns:
- a collection of the validation messages.
-
validateBundleMethod
private java.util.Collection<ValidationMessage> validateBundleMethod(MessageMethod messageMethod)
-
validateLogger
private java.util.Collection<ValidationMessage> validateLogger(java.util.Set<MessageMethod> messageMethods)
Validate message logger messageMethods.- Parameters:
messageMethods- the messageMethods to validate.- Returns:
- a collection of the validation messages.
-
validateLoggerMethod
private java.util.Collection<ValidationMessage> validateLoggerMethod(MessageMethod messageMethod)
-
getAllMethods
private java.util.Set<MessageMethod> getAllMethods(MessageInterface messageInterface)
Finds all methods for the given interface, but ignores logger interface methods.- Parameters:
messageInterface- the interface to find all methods for.- Returns:
- a set of all the methods (exception logger interface methods) the interface must implement.
-
isTypeAssignableFrom
private boolean isTypeAssignableFrom(javax.lang.model.element.Element element, java.lang.Class<?> type)Checks the element type, if an array the type of the array is checked, against the class. If the element type is assignable to the class type.- Parameters:
element- the element to testtype- the type the element needs to be assignable to- Returns:
trueif the element type is assignable to the class type, otherwisefalse
-
isTypeAssignableFrom
private boolean isTypeAssignableFrom(javax.lang.model.type.TypeMirror typeMirror, java.lang.Class<?> type)Checks the type, if an array the type of the array is checked, against the class. If the element type is assignable to the class type.- Parameters:
typeMirror- the type to testtype- the type the element needs to be assignable to- Returns:
trueif the element type is assignable to the class type, otherwisefalse
-
isTypeAssignableFrom
private boolean isTypeAssignableFrom(javax.lang.model.type.TypeMirror typeMirror, javax.lang.model.type.TypeMirror type)Checks the type, if an array the type of the array is checked, against the class. If the element type is assignable to the class type.- Parameters:
typeMirror- the type to testtype- the type the element needs to be assignable to- Returns:
trueif the element type is assignable to the class type, otherwisefalse
-
-