Property Validation Handlers |
|---|
| Class | Description | Restrictions | Link |
|---|---|---|---|
| PropertyValidationHandler | Interface which all PropertyValidationHandlers must implement. | None | JavaAPI Doc |
| LoggingPropertyValidationHandler | Valid log messages to logger, System.out or System.err.A boolean can defined if a System.exit should be performed in the afterValidation() method. |
None | JavaAPI Doc |
| SendMessagePropertyValidationHandler |
Will first call the super methods in LoggingPropertyValidationHandler, if anything is invalid it will send a message via implemented instance ValidationMessenger in the afterValidation() method. There is current no implementation of ValidationMessenger interface in the standard framework, but one exists in JHPropertiesTypedExtensions which can send emails.
|
None | JavaAPI Doc |
| Example 01 | |||
public class FileDemoProperties extends PropertyStaticCollection implements DemoProperties {
private FileDemoProperties(boolean readonly, boolean cached) {
super(new FilePropertyIO(new File("c:/app/resources/properties/app.properties",readonly,cached));
}
@Override
public void preValidation() {
//Method that will be called before collection is initialized
setPropertyValidationHandler(new MyEmailPropertyValidationHandler("host.mycomp.com"));
}
private FileDemoProperties instance = null;
public static FileDemoProperties getInstance() {
if (instance==null) {
instance = new FileDemoProperties(false, true);
}
}
}
|
|||