コード例 #1
0
ファイル: UpdateAttribute.java プロジェクト: RajiMenon/nifi
        @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);
        }