Class PropertyDescription
java.lang.Object
org.apache.sling.feature.extension.apiregions.api.config.AttributeableEntity
org.apache.sling.feature.extension.apiregions.api.config.DescribableEntity
org.apache.sling.feature.extension.apiregions.api.config.PropertyDescription
- Direct Known Subclasses:
FrameworkPropertyDescription
Instances of this class represent a single configuration property
This class is not thread safe.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear the object and reset to defaultsprotected jakarta.json.JsonObjectBuilderConvert this object into JSONvoidfromJSONObject(jakarta.json.JsonObject jsonObj) Extract the metadata from the JSON object.intGet the cardinalityGet the optional default value.String[]Get the excludesString[]Get the includesGet the internal mode.getMode()Get the validation mode.Get the list of optionsGet the placeholder policy.Get the placeholder regexGet the placeholder regex patterngetRange()Get the rangegetRegex()Get the regexGet the regex patterngetType()Get the property typeGet the variablebooleanIs this property required?voidsetCardinality(int value) Set the cardinality The default cardinality is1.protected voidApply the non-null default values.voidsetDefaultValue(Object val) Set the optional default value.voidsetExcludes(String[] excludes) Set the excludesvoidsetIncludes(String[] includes) Set the includesvoidsetInternalMode(Mode value) Set the internal modevoidSet the validation modevoidsetOptions(List<Option> options) Set the list of optionsvoidSet the placeholder policyvoidsetPlaceholderRegex(String regex) Set the placeholder regexvoidSet the rangevoidSet the regexvoidsetRequired(boolean flag) Set whether this property is requiredvoidsetType(PropertyType type) Set the property typevoidsetVariable(String variable) Set the variableMethods inherited from class DescribableEntity
getDeprecated, getDescription, getEnforceOn, getSince, getTitle, setDeprecated, setDescription, setEnforceOn, setSince, setTitleMethods inherited from class AttributeableEntity
getAttributes, getBoolean, getInteger, getNumber, getString, getString, getStringArray, setString, setStringArray, toJSONObject
-
Constructor Details
-
PropertyDescription
public PropertyDescription()Create a new description
-
-
Method Details
-
setDefaults
protected void setDefaults()Description copied from class:AttributeableEntityApply the non-null default values.- Overrides:
setDefaultsin classAttributeableEntity
-
clear
public void clear()Clear the object and reset to defaults- Overrides:
clearin classDescribableEntity
-
fromJSONObject
Extract the metadata from the JSON object. This method first callsclear()- Overrides:
fromJSONObjectin classDescribableEntity- Parameters:
jsonObj- The JSON Object- Throws:
IOException- If JSON parsing fails
-
createJson
Convert this object into JSON- Overrides:
createJsonin classDescribableEntity- Returns:
- The json object builder
- Throws:
IOException- If generating the JSON fails
-
getType
-
setType
-
getCardinality
public int getCardinality()Get the cardinality- Returns:
- the cardinality
-
setCardinality
public void setCardinality(int value) Set the cardinality The default cardinality is1. If the value is greater than zero the property can contain up to that number of values. If the cardinality is-1the property can hold an unlimited number of values.- Parameters:
value- the cardinality to set- Throws:
IllegalArgumentException- If the value is0or below-1.
-
getVariable
-
setVariable
Set the variable- Parameters:
variable- the variable to set
-
getRange
-
setRange
-
getIncludes
-
setIncludes
Set the includes- Parameters:
includes- the includes to set
-
getExcludes
-
setExcludes
Set the excludes- Parameters:
excludes- the excludes to set
-
getOptions
-
setOptions
-
getRegex
-
setRegex
Set the regex- Parameters:
regex- the regex to set- Throws:
IllegalArgumentException- If the pattern is not valid
-
getRegexPattern
-
isRequired
public boolean isRequired()Is this property required?- Returns:
trueif it is required
-
setRequired
public void setRequired(boolean flag) Set whether this property is required- Parameters:
flag- The new value
-
getDefaultValue
Get the optional default value.- Returns:
- The default value or
null - Since:
- 1.2
-
setDefaultValue
Set the optional default value.- Parameters:
val- The default value- Since:
- 1.2
-
getMode
-
setMode
Set the validation mode- Parameters:
value- The validation mode- Since:
- 1.2
-
getInternalMode
-
setInternalMode
-
getPlaceholderPolicy
Get the placeholder policy.- Returns:
- The policy
- Since:
- 1.3
-
setPlaceholderPolicy
Set the placeholder policy- Parameters:
policy- The new policy- Since:
- 1.3
-
getPlaceholderRegex
Get the placeholder regex- Returns:
- the placeholder regex or
null - Since:
- 1.3
-
setPlaceholderRegex
Set the placeholder regex- Parameters:
regex- the placeholder regex to set- Throws:
IllegalArgumentException- If the pattern is not valid- Since:
- 1.3
-
getPlaceholderRegexPattern
Get the placeholder regex pattern- Returns:
- The pattern or
null - Since:
- 1.3
-