ParameterConstraintLocation(Executable executable, int index) { this.executable = executable; this.index = index; this.typeForValidatorResolution = ReflectionHelper.boxedType( ReflectionHelper.typeOf( executable, index ) ); }
private ConstraintLocation(Class<?> declaringClass, Member member, Type typeOfAnnotatedElement) { this.declaringClass = declaringClass; this.member = member; this.propertyName = member == null ? null : ReflectionHelper.getPropertyName( member ); if ( typeOfAnnotatedElement instanceof Class && ( (Class<?>) typeOfAnnotatedElement ).isPrimitive() ) { this.typeForValidatorResolution = ReflectionHelper.boxedType( (Class<?>) typeOfAnnotatedElement ); } else { this.typeForValidatorResolution = typeOfAnnotatedElement; } }
ReturnValueConstraintLocation(Executable executable) { this.executable = executable; this.typeForValidatorResolution = ReflectionHelper.boxedType( ReflectionHelper.typeOf( executable ) ); }
private static Optional<Class<?>> getExtractedType(AnnotatedParameterizedType valueExtractorDefinition) { AnnotatedType containerType = valueExtractorDefinition.getAnnotatedActualTypeArguments()[0]; if ( containerType.isAnnotationPresent( ExtractedValue.class ) ) { Class<?> extractedType = containerType.getAnnotation( ExtractedValue.class ).type(); if ( !void.class.equals( extractedType ) ) { return Optional.of( ReflectionHelper.boxedType( extractedType ) ); } } return Optional.empty(); }
TypeArgumentConstraintLocation(ConstraintLocation delegate, TypeVariable<?> typeParameter, Type typeOfAnnotatedElement) { this.delegate = delegate; this.typeParameter = typeParameter; this.typeForValidatorResolution = ReflectionHelper.boxedType( typeOfAnnotatedElement ); this.containerClass = TypeHelper.getErasedReferenceType( delegate.getTypeForValidatorResolution() ); ConstraintLocation outerDelegate = delegate; while ( outerDelegate instanceof TypeArgumentConstraintLocation ) { outerDelegate = ( (TypeArgumentConstraintLocation) outerDelegate ).delegate; } this.outerDelegate = outerDelegate; this.hashCode = buildHashCode( delegate, typeParameter ); }
GetterConstraintLocation( Class<?> declaringClass, Method method ) { this.method = method; this.accessibleMethod = getAccessible( method ); this.propertyName = ReflectionHelper.getPropertyName( method ); this.typeForValidatorResolution = ReflectionHelper.boxedType( ReflectionHelper.typeOf( method ) ); this.declaringClass = declaringClass; }
FieldConstraintLocation(Field field) { this.field = field; this.accessibleField = getAccessible( field ); this.propertyName = ReflectionHelper.getPropertyName( field ); this.typeForValidatorResolution = ReflectionHelper.boxedType( ReflectionHelper.typeOf( field ) ); }