@Override public ValidationResult validate(final String subject, final String value, final ValidationContext context) { if (context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(value)) { final ResultType resultType = context.newExpressionLanguageCompiler().getResultType(value); if (!resultType.equals(ResultType.STRING)) { return new ValidationResult.Builder() .subject(subject) .input(value) .valid(false) .explanation("Expected Attribute Query to return type " + ResultType.STRING + " but query returns type " + resultType) .build(); } return new ValidationResult.Builder().subject(subject).input(value).explanation("Expression Language Present").valid(true).build(); } String reason = null; try { if (!Charset.isSupported(value)) { reason = "Character Set is not supported by this JVM."; } } catch (final UnsupportedCharsetException uce) { reason = "Character Set is not supported by this JVM."; } catch (final IllegalArgumentException iae) { reason = "Character Set value cannot be null."; } return new ValidationResult.Builder().subject(subject).input(value).explanation(reason).valid(reason == null).build(); } };
if (resultType != ResultType.BOOLEAN) { results.add(new ValidationResult.Builder().valid(false).input(propValue).subject(descriptor.getName()) .explanation("expression returns type of " + resultType.name() + " but is required to return a Boolean value").build());
if (resultType != ResultType.BOOLEAN) { results.add(new ValidationResult.Builder().valid(false).input(propValue).subject(descriptor.getName()) .explanation("expression returns type of " + resultType.name() + " but is required to return a Boolean value").build());
@Override public ValidationResult validate(final String subject, final String value, final ValidationContext context) { if (context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(value)) { final ResultType resultType = context.newExpressionLanguageCompiler().getResultType(value); if (!resultType.equals(ResultType.STRING)) { return new ValidationResult.Builder() .subject(subject) .input(value) .valid(false) .explanation("Expected Attribute Query to return type " + ResultType.STRING + " but query returns type " + resultType) .build(); } return new ValidationResult.Builder().subject(subject).input(value).explanation("Expression Language Present").valid(true).build(); } String reason = null; try { if (!Charset.isSupported(value)) { reason = "Character Set is not supported by this JVM."; } } catch (final UnsupportedCharsetException uce) { reason = "Character Set is not supported by this JVM."; } catch (final IllegalArgumentException iae) { reason = "Character Set value cannot be null."; } return new ValidationResult.Builder().subject(subject).input(value).explanation(reason).valid(reason == null).build(); } };
@Override public ValidationResult validate(String subject, String input, ValidationContext context) { if (context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(input)) { final AttributeExpression.ResultType resultType = context.newExpressionLanguageCompiler().getResultType(input); if (!resultType.equals(AttributeExpression.ResultType.STRING)) { return new ValidationResult.Builder() .subject(subject) .input(input) .valid(false) .explanation("Expected property to to return type " + AttributeExpression.ResultType.STRING + " but expression returns type " + resultType) .build(); } return new ValidationResult.Builder() .subject(subject) .input(input) .valid(true) .explanation("Property returns type " + AttributeExpression.ResultType.STRING) .build(); } return DPV_RE_VALIDATOR.validate(subject, input, context); } };
@Override public ValidationResult validate(final String subject, final String input, final ValidationContext context) { final String syntaxError = context.newExpressionLanguageCompiler().validateExpression(input, allowExtraCharacters); if (syntaxError != null) { return new ValidationResult.Builder().subject(subject).input(input).valid(false).explanation(syntaxError).build(); } final ResultType resultType = allowExtraCharacters ? ResultType.STRING : context.newExpressionLanguageCompiler().getResultType(input); if (!resultType.equals(expectedResultType)) { return new ValidationResult.Builder() .subject(subject) .input(input) .valid(false) .explanation("Expected Attribute Query to return type " + expectedResultType + " but query returns type " + resultType) .build(); } return new ValidationResult.Builder().subject(subject).input(input).valid(true).build(); } };
@Override public ValidationResult validate(String subject, String input, ValidationContext context) { if (context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(input)) { final AttributeExpression.ResultType resultType = context.newExpressionLanguageCompiler().getResultType(input); if (!resultType.equals(AttributeExpression.ResultType.STRING)) { return new ValidationResult.Builder() .subject(subject) .input(input) .valid(false) .explanation("Expected property to to return type " + AttributeExpression.ResultType.STRING + " but expression returns type " + resultType) .build(); } return new ValidationResult.Builder() .subject(subject) .input(input) .valid(true) .explanation("Property returns type " + AttributeExpression.ResultType.STRING) .build(); } return DPV_RE_VALIDATOR.validate(subject, input, context); } };
@Override public ValidationResult validate(final String subject, final String input, final ValidationContext context) { final String syntaxError = context.newExpressionLanguageCompiler().validateExpression(input, allowExtraCharacters); if (syntaxError != null) { return new ValidationResult.Builder().subject(subject).input(input).valid(false).explanation(syntaxError).build(); } final ResultType resultType = allowExtraCharacters ? ResultType.STRING : context.newExpressionLanguageCompiler().getResultType(input); if (!resultType.equals(expectedResultType)) { return new ValidationResult.Builder() .subject(subject) .input(input) .valid(false) .explanation("Expected Attribute Query to return type " + expectedResultType + " but query returns type " + resultType) .build(); } return new ValidationResult.Builder().subject(subject).input(input).valid(true).build(); } };