Class GwtSpecificValidatorClassCreator


  • public class GwtSpecificValidatorClassCreator
    extends Object
    • Constructor Detail

      • GwtSpecificValidatorClassCreator

        public GwtSpecificValidatorClassCreator​(ProcessingEnvironment processingEnv,
                                                Set<TypeMirror> validGroups)
        constructor.
        Parameters:
        processingEnv - processing environment
        validGroups - set of validation groups
    • Method Detail

      • writeClass

        public Set<TypeMirror> writeClass​(TypeMirror typeMirror)
        write validation class for a given type mirror.
        Parameters:
        typeMirror - type mirror of class to validate
        Returns:
        additional interfaces to create
      • writeClassBody

        protected void writeClassBody​(PrintWriter out,
                                      TypeMirror typeMirror)
                               throws com.google.gwt.core.ext.UnableToCompleteException
        Throws:
        com.google.gwt.core.ext.UnableToCompleteException
      • getValidatorForType

        protected TypeMirror getValidatorForType​(TypeElementConstraintDescriptor<?> constraint,
                                                 TypeMirror targetType)
                                          throws javax.validation.UnexpectedTypeException
        Gets the best ConstraintValidator.

        The ConstraintValidator chosen to validate a declared type targetType is the one where the type supported by the ConstraintValidator is a supertype of targetType and where there is no other ConstraintValidator whose supported type is a supertype of type and not a supertype of the chosen ConstraintValidator supported type.

        Parameters:
        constraint - the constraint to find ConstraintValidators for.
        targetType - The type to find a ConstraintValidator for.
        Returns:
        ConstraintValidator
        Throws:
        javax.validation.UnexpectedTypeException - if there is not exactly one maximally specific constraint validator for targetType.
      • writeUnsafeNativeLongIfNeeded

        protected void writeUnsafeNativeLongIfNeeded​(PrintWriter out,
                                                     TypeMirror typeMirror)