Class Validator
java.lang.Object
org.jboss.logging.processor.validation.Validator
Date: 12.08.2011
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Collection
<String> private final Elements
private final IdLengthValidator
private final IdRangeValidator
private final MessageIdValidator
private final ProcessingEnvironment
private final Types
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Set
<MessageMethod> getAllMethods
(MessageInterface messageInterface) Finds all methods for the given interface, but ignores logger interface methods.private boolean
isTypeAssignableFrom
(Element element, Class<?> type) Checks the element type, if an array the type of the array is checked, against the class.private boolean
isTypeAssignableFrom
(TypeMirror typeMirror, Class<?> type) Checks the type, if an array the type of the array is checked, against the class.private boolean
isTypeAssignableFrom
(TypeMirror typeMirror, TypeMirror type) Checks the type, if an array the type of the array is checked, against the class.final Collection
<ValidationMessage> validate
(MessageInterface messageInterface) Validates the message interface and returns a collection of validation messages or an empty collection.private Collection
<ValidationMessage> validateBundle
(Set<MessageMethod> messageMethods) Validate message bundle messageMethods.private Collection
<ValidationMessage> validateBundleMethod
(MessageMethod messageMethod) private Collection
<ValidationMessage> validateCommon
(MessageInterface messageInterface, Set<MessageMethod> messageMethods) Validate common attributes to all interfaces.private Collection
<ValidationMessage> validateLogger
(Set<MessageMethod> messageMethods) Validate message logger messageMethods.private Collection
<ValidationMessage> validateLoggerMethod
(MessageMethod messageMethod) private Collection
<ValidationMessage> validateParameters
(MessageMethod messageMethod) private void
validateTransform
(List<ValidationMessage> messages, Parameter parameter, Transform transform)
-
Field Details
-
AVAILABLE_LANGUAGES
-
messageIdValidator
-
idLengthValidator
-
idRangeValidator
-
processingEnv
-
elements
-
types
-
-
Constructor Details
-
Validator
-
-
Method Details
-
validate
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 Collection<ValidationMessage> validateCommon(MessageInterface messageInterface, 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(List<ValidationMessage> messages, Parameter parameter, Transform transform) -
validateParameters
-
validateBundle
Validate message bundle messageMethods.- Parameters:
messageMethods
- the messageMethods to validate.- Returns:
- a collection of the validation messages.
-
validateBundleMethod
-
validateLogger
Validate message logger messageMethods.- Parameters:
messageMethods
- the messageMethods to validate.- Returns:
- a collection of the validation messages.
-
validateLoggerMethod
-
getAllMethods
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
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:
true
if the element type is assignable to the class type, otherwisefalse
-
isTypeAssignableFrom
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:
true
if the element type is assignable to the class type, otherwisefalse
-
isTypeAssignableFrom
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:
true
if the element type is assignable to the class type, otherwisefalse
-