public class ArtifactRules extends AttributeableEntity
Modifier and Type | Field and Description |
---|---|
static String |
EXTENSION_NAME
The name of the feature model extension.
|
Constructor and Description |
---|
ArtifactRules()
Create a new rules object
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the object and reset to defaults
|
javax.json.JsonObjectBuilder |
createJson()
Convert this object into JSON
|
void |
fromJSONObject(javax.json.JsonObject jsonObj)
Extract the metadata from the JSON object.
|
static ArtifactRules |
getArtifactRules(org.apache.sling.feature.Extension ext)
Get the artifact rules from the extension - if it exists.
|
static ArtifactRules |
getArtifactRules(org.apache.sling.feature.Feature feature)
Get the artifact rules from the feature - if it exists.
|
List<VersionRule> |
getArtifactVersionRules()
Return the list of version rules for artifacts.
|
List<VersionRule> |
getBundleVersionRules()
Return the list of version rules for bundles.
|
Mode |
getMode()
Get the validation mode.
|
static void |
setArtifactRules(org.apache.sling.feature.Feature feature,
ArtifactRules rules)
Set the rules as an extension to the feature
|
protected void |
setDefaults()
Apply the non-null default values.
|
void |
setMode(Mode value)
Set the validation mode
|
getAttributes, getBoolean, getInteger, getNumber, getString, getString, getStringArray, setString, setStringArray, toJSONObject
public static final String EXTENSION_NAME
public static ArtifactRules getArtifactRules(org.apache.sling.feature.Feature feature)
setArtifactRules(Feature, ArtifactRules)
can be used to update
the feature.feature
- The featurenull
.IllegalArgumentException
- If the extension is wrongly formattedpublic static ArtifactRules getArtifactRules(org.apache.sling.feature.Extension ext)
setArtifactRules(Feature, ArtifactRules)
can be used to update
the feature.ext
- The extensionnull
if the extension is null
.IllegalArgumentException
- If the extension is wrongly formattedpublic static void setArtifactRules(org.apache.sling.feature.Feature feature, ArtifactRules rules)
feature
- The featurerules
- The rules. If null
the extension will be removed.IllegalStateException
- If the feature has already an extension of a wrong typeIllegalArgumentException
- If the rules can't be serialized to JSONprotected void setDefaults()
AttributeableEntity
setDefaults
in class AttributeableEntity
public void clear()
clear
in class AttributeableEntity
public javax.json.JsonObjectBuilder createJson() throws IOException
createJson
in class AttributeableEntity
IOException
- If generating the JSON failspublic void fromJSONObject(javax.json.JsonObject jsonObj) throws IOException
clear()
.fromJSONObject
in class AttributeableEntity
jsonObj
- The JSON ObjectIOException
- If JSON parsing failspublic Mode getMode()
Mode.STRICT
public void setMode(Mode value)
value
- The validation modepublic List<VersionRule> getBundleVersionRules()
public List<VersionRule> getArtifactVersionRules()
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.