public class VersionRule extends AttributeableEntity
Constructor and Description |
---|
VersionRule()
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.
|
org.osgi.framework.VersionRange[] |
getAllowedVersionRanges()
The allowed version ranges
|
org.apache.sling.feature.ArtifactId |
getArtifactId()
Get the artifact id
|
org.osgi.framework.VersionRange[] |
getDeniedVersionRanges()
Get the denied version ranges
|
String |
getMessage()
The validation message
|
Mode |
getMode()
Get the validation mode.
|
boolean |
isAllowed(org.osgi.framework.Version artifactVersion)
Check if a version is allowed according to the rules
|
void |
setAllowedVersionRanges(org.osgi.framework.VersionRange[] allowedVersions)
Set the allowed version ranges
|
void |
setArtifactId(org.apache.sling.feature.ArtifactId artifactId)
Set the artifact id
|
void |
setDeniedVersionRanges(org.osgi.framework.VersionRange[] deniedVersions)
Set the denied version ranges
|
void |
setMessage(String message)
Set the validation message
|
void |
setMode(Mode value)
Set the validation mode
|
getAttributes, getBoolean, getInteger, getNumber, getString, getString, getStringArray, setDefaults, setString, setStringArray, toJSONObject
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 org.apache.sling.feature.ArtifactId getArtifactId()
public void setArtifactId(org.apache.sling.feature.ArtifactId artifactId)
artifactId
- the artifactId to setpublic String getMessage()
public void setMessage(String message)
message
- the message to setpublic org.osgi.framework.VersionRange[] getAllowedVersionRanges()
null
public void setAllowedVersionRanges(org.osgi.framework.VersionRange[] allowedVersions)
allowedVersions
- the allowedVersions to setpublic org.osgi.framework.VersionRange[] getDeniedVersionRanges()
null
public void setDeniedVersionRanges(org.osgi.framework.VersionRange[] deniedVersions)
deniedVersions
- the deniedVersions to setpublic boolean isAllowed(org.osgi.framework.Version artifactVersion)
artifactVersion
- The versiontrue
if it is allowed, false
otherwiseCopyright © 2007–2021 The Apache Software Foundation. All rights reserved.