@Override public void returnAttributesValidation(ReturnAttribute[] returnAttributes) throws AnnotationValidationException { if (returnAttributes != null && returnAttributes.length > 0) { //Throw error for other classes as only in the classes extending //StreamProcessor or StreamFunctionProcessor allowed to have more than one ReturnAttribute. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @ReturnAttribute " + "cannot be annotated in class {0}.", extensionClassFullName)); } } }
@Override public void returnAttributesValidation(ReturnAttribute[] returnAttributes) throws AnnotationValidationException { if (returnAttributes != null && returnAttributes.length > 0) { //Throw error for other classes as only in the classes extending //StreamProcessor or StreamFunctionProcessor allowed to have more than one ReturnAttribute. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @ReturnAttribute " + "cannot be annotated in class {0}.", extensionClassFullName)); } } }
@Override public void returnAttributesValidation(ReturnAttribute[] returnAttributes) throws AnnotationValidationException { if (returnAttributes != null && returnAttributes.length > 0) { //Throw error for other classes as only in the classes extending //StreamProcessor or StreamFunctionProcessor allowed to have more than one ReturnAttribute. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @ReturnAttribute " + "cannot be annotated in class {0}.", extensionClassFullName)); } } }
@Override public void returnAttributesValidation(ReturnAttribute[] returnAttributes) throws AnnotationValidationException { if (returnAttributes != null && returnAttributes.length > 0) { //Throw error for other classes as only in the classes extending //StreamProcessor or StreamFunctionProcessor allowed to have more than one ReturnAttribute. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @ReturnAttribute" + " cannot be annotated in class {0}.", extensionClassFullName)); } } }
@Override public void returnAttributesValidation(ReturnAttribute[] returnAttributes) throws AnnotationValidationException { if (returnAttributes != null && returnAttributes.length > 0) { //Throw error for other classes as only in the classes extending //StreamProcessor or StreamFunctionProcessor allowed to have more than one ReturnAttribute. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @ReturnAttribute " + "cannot be annotated in class {0}.", extensionClassFullName)); } } }
@Override public void returnAttributesValidation(ReturnAttribute[] returnAttributes) throws AnnotationValidationException { if (returnAttributes != null && returnAttributes.length > 0) { //Throw error for other classes as only in the classes extending //StreamProcessor or StreamFunctionProcessor allowed to have more than one ReturnAttribute. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @ReturnAttribute" + " cannot be annotated in class {0}.", extensionClassFullName)); } } }
@Override public void returnAttributesValidation(ReturnAttribute[] returnAttributes) throws AnnotationValidationException { if (returnAttributes != null && returnAttributes.length > 0) { //Throw error for other classes as only in the classes extending //StreamProcessor or StreamFunctionProcessor allowed to have more than one ReturnAttribute. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @ReturnAttribute " + "cannot be annotated in class {0}.", extensionClassFullName)); } } }
@Override public void parameterValidation(Parameter[] parameters) throws AnnotationValidationException { if (parameters != null && parameters.length > 0) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter " + "cannot be annotated in class {0}. As this class extends from super class {1}.", extensionClassFullName, AnnotationConstants.DISTRIBUTION_STRATEGY_SUPER_CLASS)); } }
@Override public void basicParameterValidation(String name, String description, String namespace) throws AnnotationValidationException { //Check if the @Extension name is empty. if (name.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> name " + " annotated in class {0} is null or empty.", extensionClassFullName)); } //Check if the @Extension description is empty. if (description.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> description " + "annotated in class {0} is null or empty.", extensionClassFullName)); } //Check if the @Extension namespace is empty. if (namespace.isEmpty()) { //The namespace cannot be null or empty as @Extension extends from namespace reserved super class. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> namespace cannot " + "be null or empty, annotated class {1} extends from namespace reserved super class {2}.", name, extensionClassFullName, AnnotationConstants.STORE_SUPER_CLASS)); } else { //Check if namespace provided matches with the reserved namespace. if (!namespace.equals(AnnotationConstants.STORE_NAMESPACE)) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> namespace " + "provided {0} should be corrected as {1} annotated in class {2}.", namespace, AnnotationConstants.STORE_NAMESPACE, extensionClassFullName)); } } }
@Override public void basicParameterValidation(String name, String description, String namespace) throws AnnotationValidationException { //Check if the @Extension name is empty. if (name.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> name " + " annotated in class {0} is null or empty.", extensionClassFullName)); } //Check if the @Extension description is empty. if (description.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> description " + "annotated in class {0} is null or empty.", extensionClassFullName)); } //Check if the @Extension namespace is empty. if (namespace.isEmpty()) { //The namespace cannot be null or empty as @Extension extends from namespace reserved super class. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> namespace " + "cannot be null or empty, annotated class {1} extends from namespace reserved super class {2}.", name, extensionClassFullName, AnnotationConstants.SINK_SUPER_CLASS)); } else { //Check if namespace provided matches with the reserved namespace. if (!namespace.equals(AnnotationConstants.SINK_NAMESPACE)) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> namespace " + "provided {0} should be corrected as {1} annotated in class {2}.", namespace, AnnotationConstants.SINK_NAMESPACE, extensionClassFullName)); } } }
@Override public void basicParameterValidation(String name, String description, String namespace) throws AnnotationValidationException { //Check if the @Extension name is empty. if (name.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> name " + " annotated in class {0} is null or empty.", extensionClassFullName)); } //Check if the @Extension description is empty. if (description.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> description " + "annotated in class {0} is null or empty.", extensionClassFullName)); } //Check if the @Extension namespace is empty. if (namespace.isEmpty()) { //The namespace cannot be null or empty as @Extension extends from namespace reserved super class. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> namespace cannot " + "be null or empty, annotated class {1} extends from namespace reserved super class {2}.", name, extensionClassFullName, AnnotationConstants.DISTRIBUTION_STRATEGY_SUPER_CLASS)); } else { //Check if namespace provided matches with the reserved namespace. if (!namespace.equals(AnnotationConstants.DISTRIBUTION_STRATEGY_NAMESPACE)) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> namespace " + "provided {0} should be corrected as {1} annotated in class {2}.", namespace, AnnotationConstants.DISTRIBUTION_STRATEGY_NAMESPACE, extensionClassFullName)); } } }
@Override public void basicParameterValidation(String name, String description, String namespace) throws AnnotationValidationException { //Check if the @Extension name is empty. if (name.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> name " + " annotated in class {0} is null or empty.", extensionClassFullName)); } //Check if the @Extension description is empty. if (description.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> description " + "annotated in class {0} is null or empty.", extensionClassFullName)); } //Check if the @Extension namespace is empty. if (namespace.isEmpty()) { //The namespace cannot be null or empty as @Extension extends from namespace reserved super class. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> namespace cannot " + "be null or empty, annotated class {1} extends from namespace reserved super class {2}.", name, extensionClassFullName, AnnotationConstants.SINK_MAPPER_SUPER_CLASS)); } else { //Check if namespace provided matches with the reserved namespace. if (!namespace.equals(AnnotationConstants.SINK_MAPPER_NAMESPACE)) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> namespace " + "provided {0} should be corrected as {1} annotated in class {2}.", namespace, AnnotationConstants.SINK_MAPPER_NAMESPACE, extensionClassFullName)); } } }
@Override public void basicParameterValidation(String name, String description, String namespace) throws AnnotationValidationException { //Check if the @Extension name is empty. if (name.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> name " + " annotated in class {0} is null or empty.", extensionClassFullName)); } //Check if the @Extension description is empty. if (description.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> description " + "annotated in class {0} is null or empty.", extensionClassFullName)); } //Check if the @Extension namespace is empty. if (namespace.isEmpty()) { //The namespace cannot be null or empty as @Extension extends from namespace reserved super class. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> namespace cannot " + "be null or empty, annotated class {1} extends from namespace reserved super class {2}.", name, extensionClassFullName, AnnotationConstants.SOURCE_MAPPER_SUPER_CLASS)); } else { //Check if namespace provided matches with the reserved namespace. if (!namespace.equals(AnnotationConstants.SOURCE_MAPPER_NAMESPACE)) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> namespace " + "provided {0} should be corrected as {1} annotated in class {2}.", namespace, AnnotationConstants.SOURCE_MAPPER_NAMESPACE, extensionClassFullName)); } } }
@Override public void basicParameterValidation(String name, String description, String namespace) throws AnnotationValidationException { //Check if the @Extension name is empty. if (name.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> name " + " annotated in class {0} is null or empty.", extensionClassFullName)); } //Check if the @Extension description is empty. if (description.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> description " + "annotated in class {0} is null or empty.", extensionClassFullName)); } //Check if the @Extension namespace is empty. if (namespace.isEmpty()) { //The namespace cannot be null or empty as @Extension extends from namespace reserved super class. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> namespace cannot " + "be null or empty, annotated class {1} extends from namespace reserved super class {2}.", name, extensionClassFullName, AnnotationConstants.SOURCE_SUPER_CLASS)); } else { //Check if namespace provided matches with the reserved namespace. if (!namespace.equals(AnnotationConstants.SOURCE_NAMESPACE)) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> namespace " + "provided {0} should be corrected as {1} annotated in class {2}.", namespace, AnnotationConstants.SOURCE_NAMESPACE, extensionClassFullName)); } } }
throw new AnnotationValidationException(MessageFormat.format("The @Extension -> name " + " annotated in class {0} is null or empty.", extensionClassFullName)); throw new AnnotationValidationException(MessageFormat.format("The @Extension -> description " + "annotated in class {0} is null or empty.", extensionClassFullName)); throw new AnnotationValidationException(MessageFormat.format("The @Extension -> namespace " + "annotated in class {0} is null or empty.", extensionClassFullName));
/** * This method uses for validate @Extension / @Example elements. * * @param examples examples array which needs to be validate. * @throws AnnotationValidationException whenever if the validate rule violate, throws the annotation validate * exception with proper message. */ public void examplesValidation(Example[] examples) throws AnnotationValidationException { //Check if the @Example annotated in all the @Extension classes. if (examples.length == 0) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Example " + "annotated in class {0} is null or empty.", extensionClassFullName)); } else { for (Example example : examples) { //Check if the @Example syntax is empty. if (example.syntax().isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@Example -> syntax annotated in class {0} is null or empty.", extensionClassFullName)); } //Check if the @Example description is empty. if (example.description().isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@Example -> description annotated in class {0} is null or empty.", extensionClassFullName)); } } } } }
if (returnAttributes.length == 0) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@ReturnAttribute annotated in class {0} is null or empty.", extensionClassFullName)); } else if (returnAttributes.length == 1) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@ReturnAttribute -> name cannot be annotated in class {1}.", extensionClassFullName)); throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@ReturnAttribute -> name:{0} -> description annotated in class {1} is null or empty.", returnAttributeName, extensionClassFullName)); throw new AnnotationValidationException(MessageFormat.format("The @Extension ->" + " @ReturnAttribute -> name{0} -> type annotated in class {1} is null or empty.", returnAttributeName, extensionClassFullName)); throw new AnnotationValidationException(MessageFormat.format("Only one @Extension -> " + "@ReturnAttribute can be annotated in class {0}.", extensionClassFullName));
@Override public void returnAttributesValidation(ReturnAttribute[] returnAttributes) throws AnnotationValidationException { for (ReturnAttribute returnAttribute : returnAttributes) { String returnAttributeName = returnAttribute.name(); //Check if the @ReturnAttributes name is empty. if (returnAttributeName.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@ReturnAttribute -> name annotated in class {0} is null or empty.", extensionClassFullName)); } else if (!CAMEL_CASE_PATTERN.matcher(returnAttributeName).find()) { //Check if the @Extension -> @ReturnAttribute -> name is in a correct camelCase // format using regex pattern. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@ReturnAttribute -> name {0} annotated in class {1} is not in camelCase format.", returnAttributeName, extensionClassFullName)); } //Check if the @ReturnAttributes description is empty. if (returnAttribute.description().isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@ReturnAttribute -> name:{0} -> description annotated in class {1} is null or empty.", returnAttributeName, extensionClassFullName)); } //Check if the @ReturnAttributes type is empty. if (returnAttribute.type().length == 0) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@ReturnAttribute -> name:{0} -> type annotated in class {1} is null or empty.", returnAttributeName, extensionClassFullName)); } } } }
@Override public void returnAttributesValidation(ReturnAttribute[] returnAttributes) throws AnnotationValidationException { for (ReturnAttribute returnAttribute : returnAttributes) { String returnAttributeName = returnAttribute.name(); //Check if the @ReturnAttributes name is empty. if (returnAttributeName.isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@ReturnAttribute -> name annotated in class {0} is null or empty.", extensionClassFullName)); } else if (!CAMEL_CASE_PATTERN.matcher(returnAttributeName).find()) { //Check if the @Extension -> @ReturnAttribute -> name is in a correct camelCase // format using regex pattern. throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@ReturnAttribute -> name {0} annotated in class {1} is not in camelCase format.", returnAttributeName, extensionClassFullName)); } //Check if the @ReturnAttributes description is empty. if (returnAttribute.description().isEmpty()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@ReturnAttribute -> name:{0} -> description annotated in class {1} is null or empty.", returnAttributeName, extensionClassFullName)); } //Check if the @ReturnAttributes type is empty. if (returnAttribute.type().length == 0) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> " + "@ReturnAttribute -> name:{0} -> type annotated in class {1} is null or empty.", returnAttributeName, extensionClassFullName)); } } } }
throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter " + "-> name annotated in class {0} is null or empty.", extensionClassFullName)); } else if (!PARAMETER_NAME_PATTERN.matcher(parameterName).find()) { throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter " + "-> name:{0} annotated in class {1} is not in proper format ''abc.def.ghi''.", parameterName, extensionClassFullName)); throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter ->" + " name:{0} -> description annotated in class {1} is null or empty.", parameterName, extensionClassFullName)); throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter ->" + " name:{0} -> type annotated in class {1} is null or empty.", parameterName, extensionClassFullName)); throw new AnnotationValidationException(MessageFormat.format("The @Extension -> @Parameter ->" + " name:{0} -> dynamic property cannot be true annotated in class {1}.", parameterName, extensionClassFullName));