Class PolicyValidator
- java.lang.Object
-
- de.fraunhofer.iese.mydata.policy.validation.PolicyValidator
-
- All Implemented Interfaces:
IPolicyValidator
,javax.validation.ConstraintValidator<MyDataPolicy,String>
public class PolicyValidator extends Object implements IPolicyValidator, javax.validation.ConstraintValidator<MyDataPolicy,String>
The Class PolicyValidator.
-
-
Constructor Summary
Constructors Constructor Description PolicyValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
initialize(MyDataPolicy constraintAnnotation)
Implementing this method is optional and is usually blank in example code.boolean
isValid(String value, javax.validation.ConstraintValidatorContext context)
Use this method to test the constraint.void
validateLanguageVersion(Policy policy)
void
validateLanguageVersion(String policyString)
void
validatePolicySolutionAndComponents(SolutionId solutionId, String policy)
void
validateXMLSchema(String policy)
-
-
-
Method Detail
-
validateXMLSchema
public void validateXMLSchema(String policy) throws InvalidEntityException
- Specified by:
validateXMLSchema
in interfaceIPolicyValidator
- Throws:
InvalidEntityException
-
validatePolicySolutionAndComponents
public void validatePolicySolutionAndComponents(SolutionId solutionId, String policy) throws InvalidEntityException
- Specified by:
validatePolicySolutionAndComponents
in interfaceIPolicyValidator
- Throws:
InvalidEntityException
-
validateLanguageVersion
public void validateLanguageVersion(Policy policy) throws InvalidEntityException
- Throws:
InvalidEntityException
-
validateLanguageVersion
public void validateLanguageVersion(String policyString) throws InvalidEntityException
- Throws:
InvalidEntityException
-
initialize
public void initialize(MyDataPolicy constraintAnnotation)
Implementing this method is optional and is usually blank in example code. Use it to setup your constraint validator. In this case, I've created a Pattern object to test the post code.- Specified by:
initialize
in interfacejavax.validation.ConstraintValidator<MyDataPolicy,String>
- See Also:
ConstraintValidator.initialize(java.lang.annotation.Annotation)
-
isValid
public boolean isValid(String value, javax.validation.ConstraintValidatorContext context)
Use this method to test the constraint.- Specified by:
isValid
in interfacejavax.validation.ConstraintValidator<MyDataPolicy,String>
- See Also:
ConstraintValidator.isValid(java.lang.Object, javax.validation.ConstraintValidatorContext)
-
-