Class ConfigCondition
java.lang.Object
com.inductiveautomation.perspective.common.ConfigCondition
Convenience class for ensuring that a json object structure has expected members in it.
- 
Method SummaryModifier and TypeMethodDescriptionstatic ConfigConditionofObject(com.inductiveautomation.ignition.common.gson.JsonElement object) optional(String name, Predicate<com.inductiveautomation.ignition.common.gson.JsonElement> predicate, Function<com.inductiveautomation.ignition.common.gson.JsonElement, String> errorMessage) General purpose optional-check.optionalArray(String name) Checks to see if a member with the given name exists.optionalBoolean(String name) Checks to see if a member with the given name exists.<E extends Enum>
 ConfigConditionoptionalEnum(String name, Class<E> enumClass) Case-sensitive enum comparison<E extends Enum>
 ConfigConditionoptionalEnum(String name, Class<E> enumClass, boolean ignoreCase) optionalObject(String name) Checks to see if a member with the given name exists.optionalOneOf(String name, JsonType... types) Checks to see if a member with the given name exists.optionalString(String name) Checks to see if a member with the given name exists.requireNonBlankString(String name) Requires that the property at the given path is a string that is not blank.requireObject(String name) Requires that the property at the given path is an object.requireOneOf(String name, JsonType... types) Requires that the property at the given path is one of the providedJsonTypes.requireString(String name) Requires that the property at the given path is a string.
- 
Method Details- 
ofObjectpublic static ConfigCondition ofObject(com.inductiveautomation.ignition.common.gson.JsonElement object) throws ConfigurationException - Throws:
- ConfigurationException
 
- 
optionalOneOfpublic ConfigCondition optionalOneOf(String name, @Nonnull JsonType... types) throws ConfigurationException Checks to see if a member with the given name exists. If it does, ensures that it is one of the providedJsonTypes- Throws:
- ConfigurationException
 
- 
requireOneOfpublic ConfigCondition requireOneOf(String name, @Nonnull JsonType... types) throws ConfigurationException Requires that the property at the given path is one of the providedJsonTypes. Does not accept null, missing, or otherwise mis-typed.- Throws:
- ConfigurationException
 
- 
requireObjectRequires that the property at the given path is an object. Does not accept null, missing, or otherwise mis-typed.- Throws:
- ConfigurationException
 
- 
requireStringRequires that the property at the given path is a string. Accepts empty string, but not null, missing, or otherwise mis-typed.- Throws:
- ConfigurationException
 
- 
requireNonBlankStringRequires that the property at the given path is a string that is not blank. Accepts empty string, but not null, missing, or otherwis mis-typed.- Throws:
- ConfigurationException
- See Also:
- 
- StringUtils.isNotBlank(CharSequence)
 
 
- 
optionalEnumpublic <E extends Enum> ConfigCondition optionalEnum(String name, Class<E> enumClass) throws ConfigurationException Case-sensitive enum comparison- Throws:
- ConfigurationException
- See Also:
 
- 
optionalEnumpublic <E extends Enum> ConfigCondition optionalEnum(String name, Class<E> enumClass, boolean ignoreCase) throws ConfigurationException - Throws:
- ConfigurationException
 
- 
optionalObjectChecks to see if a member with the given name exists. If it does, ensures that it is an object.- Throws:
- ConfigurationException
 
- 
optionalArrayChecks to see if a member with the given name exists. If it does, ensures that it is an array.- Throws:
- ConfigurationException
 
- 
optionalBooleanChecks to see if a member with the given name exists. If it does, ensures that it is a boolean.- Throws:
- ConfigurationException
 
- 
optionalStringChecks to see if a member with the given name exists. If it does, ensures that it is a string.- Throws:
- ConfigurationException
 
- 
optionalpublic ConfigCondition optional(String name, Predicate<com.inductiveautomation.ignition.common.gson.JsonElement> predicate, Function<com.inductiveautomation.ignition.common.gson.JsonElement, String> errorMessage) throws ConfigurationExceptionGeneral purpose optional-check. If the object at the given name is missing, this is OK. But if the object is present, it must pass the predicate.- Throws:
- ConfigurationException
 
 
-