public class ActivationValidator extends Object implements Serializable
null the Property is valid.
public interface MyProperties {
public final static Property<Integer> PORT_NUMBER = new Property<Integer>("port.number",new IntegerPropertyType(80));
public final static Property<Integer> A_SSL_CONFIG = new Property<Integer>("ssl.keystore",new StringPropertyType(),true); //null allowed.
}
public class MyPropertiesDemo extends PropertyStaticCollection implements MyProperties {
public MyPropertiesDemo(FilePropertyIO io) {
super(io);
}
public void postValidation() throws PropertyException {
ActivationValidator activator = new ActivationValidator();
activator.given(MyProperties.PORT_NUMBER.getTypedValue()==443,A_SSL_CONFIG);
}
}
Property.isDefined(),
Property.isValid(),
Serialized Form| Constructor and Description |
|---|
ActivationValidator()
Constuctor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isDefinedAndValid(Property<?> property)
Determines if a Property is defined and valid.
|
void |
validate(boolean given,
Property<?>... thanMustBeDefined)
Validates a when a certain condition is
true, all provided properties must be defined. |
void |
validate(Property<?> givenPropertyDefined,
Object shouldEquals,
Property<?>... thanMustBeDefined)
Validates that a Property typed value is equal a value; if so ; than all the properties in the array must be weel defined.
|
void |
validate(Property<?> givenPropertyDefined,
Property<?>... thanMustBeDefined)
Validates that if the Property givenPropertyDefined is not
null AND is valid, all the other Properties thanMustBeDefined must be not null and well defined. |
void |
validateMustBeDefined(Property<?>... thanMustBeDefined)
Validates an array of Property's that they all are weel defined.
|
public final void validate(Property<?> givenPropertyDefined, Property<?>... thanMustBeDefined) throws PropertyException
null AND is valid, all the other Properties thanMustBeDefined must be not null and well defined. givenPropertyDefined - thanMustBeDefined - PropertyExceptionpublic final void validate(boolean given,
Property<?>... thanMustBeDefined)
throws PropertyException
true, all provided properties must be defined.given - the paramter that must be true before all the properties provided must be defined.thanMustBeDefined - the array of properties that must be well defined.PropertyException - if one if the provided properties is not welldefined is the given is true.public final void validate(Property<?> givenPropertyDefined, Object shouldEquals, Property<?>... thanMustBeDefined) throws PropertyException
givenPropertyDefined - if a given properties is not null and well defined, and equals with the parameter shouldEquals.shouldEquals - the value which the Property toType() must be equal.thanMustBeDefined - the propeties which must be well defined if above condition is true.PropertyException - if one if the provided properties is not welldefined if above condition is true.public final void validateMustBeDefined(Property<?>... thanMustBeDefined) throws PropertyException
thanMustBeDefined - the array of Property's to validate to be weel defined.PropertyException - if one if the provided properties is not welldefinedpublic final boolean isDefinedAndValid(Property<?> property) throws NullPointerException
property - the property.true if the string value is not null and the property is validated successfully, otherwise false.NullPointerException - if property is null.Property.isDefined(),
Property.isValid()