private Method replaceWithOverriddenOrInterfaceMethod(Method method, List<Method> allMethodsOfType) { LinkedList<Method> list = new LinkedList<>( allMethodsOfType ); Iterator<Method> iterator = list.descendingIterator(); while ( iterator.hasNext() ) { Method overriddenOrInterfaceMethod = iterator.next(); if ( executableHelper.overrides( method, overriddenOrInterfaceMethod ) ) { if ( method.getAnnotation( ValidateOnExecution.class ) != null ) { throw log.getValidateOnExecutionOnOverriddenOrInterfaceMethodException( method ); } return overriddenOrInterfaceMethod; } } return method; } }
private EnumSet<ExecutableType> commonExecutableTypeChecks(ValidateOnExecution validateOnExecutionAnnotation) { if ( validateOnExecutionAnnotation == null ) { return EnumSet.noneOf( ExecutableType.class ); } EnumSet<ExecutableType> executableTypes = EnumSet.noneOf( ExecutableType.class ); if ( validateOnExecutionAnnotation.type().length == 0 ) { // HV-757 executableTypes.add( ExecutableType.NONE ); } else { Collections.addAll( executableTypes, validateOnExecutionAnnotation.type() ); } // IMPLICIT cannot be mixed 10.1.2 of spec - Mixing IMPLICIT and other executable types is illegal if ( executableTypes.contains( ExecutableType.IMPLICIT ) && executableTypes.size() > 1 ) { throw log.getMixingImplicitWithOtherExecutableTypesException(); } // NONE can be removed 10.1.2 of spec - A list containing NONE and other types of executables is equivalent to a // list containing the types of executables without NONE. if ( executableTypes.contains( ExecutableType.NONE ) && executableTypes.size() > 1 ) { executableTypes.remove( ExecutableType.NONE ); } // 10.1.2 of spec - A list containing ALL and other types of executables is equivalent to a list containing only ALL if ( executableTypes.contains( ExecutableType.ALL ) ) { executableTypes = ALL_EXECUTABLE_TYPES; } return executableTypes; }
private void validateParameters() { if ( min < 0 ) { throw LOG.getMinCannotBeNegativeException(); } if ( max < 0 ) { throw LOG.getMaxCannotBeNegativeException(); } if ( max < min ) { throw LOG.getLengthCannotBeNegativeException(); } } }
@Override public final String beanTypeCannotBeNull() { return beanTypeCannotBeNull$str(); } private static final String propertyPathCannotBeNull = "null is not allowed as property path.";
@Override public final String propertyPathCannotBeNull() { return propertyPathCannotBeNull$str(); } private static final String propertyNameMustNotBeEmpty = "The property name must not be empty.";
@Override public final String validatedObjectMustNotBeNull() { return validatedObjectMustNotBeNull$str(); } private static final String validatedMethodMustNotBeNull = "The method to be validated must not be null.";
@Override public final String validatedParameterArrayMustNotBeNull() { return validatedParameterArrayMustNotBeNull$str(); } private static final String validatedConstructorCreatedInstanceMustNotBeNull = "The created instance must not be null.";
@Override public final String validatedConstructorCreatedInstanceMustNotBeNull() { return validatedConstructorCreatedInstanceMustNotBeNull$str(); } private static final String inputStreamCannotBeNull = "The input stream for #addMapping() cannot be null.";
@Override public final String annotationTypeMustBeAnnotatedWithConstraint() { return annotationTypeMustBeAnnotatedWithConstraint$str(); } }
@Override public final String groupMustNotBeNull() { return groupMustNotBeNull$str(); } private static final String beanTypeMustNotBeNull = "The bean type must not be null when creating a constraint mapping.";
@Override public final String classCannotBeNull() { return classCannotBeNull$str(); } private static final String classIsNull = "Class is null.";
@Override public final String validatedConstructorMustNotBeNull() { return validatedConstructorMustNotBeNull$str(); } private static final String validatedParameterArrayMustNotBeNull = "The method parameter array cannot not be null.";
public static void assertTrue(boolean condition, String message) { if ( !condition ) { throw LOG.getIllegalArgumentException( message ); } }
private Integer getTypeArgumentIndex(TypeVariable<?>[] typeParameters, boolean isArray, Type enclosingType) { if ( isArray ) { return null; } if ( typeArgumentIndex == null ) { if ( typeParameters.length > 1 ) { throw LOG.getNoTypeArgumentIndexIsGivenForTypeWithMultipleTypeArgumentsException( enclosingType ); } return 0; } return typeArgumentIndex; }
private void validateParameters() { if ( min < 0 ) { throw LOG.getMinCannotBeNegativeException(); } if ( max < 0 ) { throw LOG.getMaxCannotBeNegativeException(); } if ( max < min ) { throw LOG.getLengthCannotBeNegativeException(); } } }
private void validateParameters() { if ( min < 0 ) { throw LOG.getMinCannotBeNegativeException(); } if ( max < 0 ) { throw LOG.getMaxCannotBeNegativeException(); } if ( max < min ) { throw LOG.getLengthCannotBeNegativeException(); } } }
private void validateParameters() { if ( min < 0 ) { throw LOG.getMinCannotBeNegativeException(); } if ( max < 0 ) { throw LOG.getMaxCannotBeNegativeException(); } if ( max < min ) { throw LOG.getLengthCannotBeNegativeException(); } } }
private void validateParameters() { if ( min < 0 ) { throw log.getMinCannotBeNegativeException(); } if ( max < 0 ) { throw log.getMaxCannotBeNegativeException(); } if ( max < min ) { throw log.getLengthCannotBeNegativeException(); } } }
private void validateParameters() { if ( min < 0 ) { throw log.getMinCannotBeNegativeException(); } if ( max < 0 ) { throw log.getMaxCannotBeNegativeException(); } if ( max < min ) { throw log.getLengthCannotBeNegativeException(); } } }
private void validateParameters() { if ( min < 0 ) { throw log.getMinCannotBeNegativeException(); } if ( max < 0 ) { throw log.getMaxCannotBeNegativeException(); } if ( max < min ) { throw log.getLengthCannotBeNegativeException(); } } }