Package ro.sync.contentcompletion.xml
Class CIAttribute
- java.lang.Object
-
- ro.sync.contentcompletion.xml.CIAttribute
-
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Comparable<CIAttribute>
,NodeDescription
@API(type=NOT_EXTENDABLE, src=PRIVATE) public class CIAttribute extends java.lang.Object implements java.lang.Comparable<CIAttribute>, NodeDescription, java.lang.Cloneable
Interface for objects holding information about attributes used in the content completion process.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
CIAttribute.DefaultValueProvider
Default value provider for an attribute.static class
CIAttribute.EditableState
The editable state of the attribute.
-
Constructor Summary
Constructors Constructor Description CIAttribute()
Default Constructor.CIAttribute(java.lang.String name, boolean required, boolean fixed, java.lang.String defaultValue, java.util.List<java.lang.String> possibleValues)
Constructor.CIAttribute(java.lang.String namespace, java.lang.String name, boolean required, boolean fixed, java.lang.String defaultValue, java.util.List<java.lang.String> possibleValues)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Allows cloning.int
compareTo(CIAttribute otherAttribute)
Compare two attributes based on the string obtained by concatenating the name and the namespace of each attribute.boolean
equals(java.lang.Object obj)
java.lang.String
getAnnotation()
Get the annotation for the attribute.java.lang.String
getAssertions()
Returns the string representation for all assertions.java.lang.String
getDefaultValue()
Gets the default value attribute of the attribute.CIAttribute.EditableState
getEditableState()
java.lang.String
getFacetFractionDigitsValue()
Gets the value of theFRACTION_DIGITS
facet corresponding to the attribute.java.lang.String
getFacetLengthValue()
Gets the value of theLENGTH
facet corresponding to the attribute.java.lang.String
getFacetMaxExclusiveValue()
Gets the value of theMAX_EXCLUSIVE
facet corresponding to the attribute.java.lang.String
getFacetMaxInclusiveValue()
Gets the value of theMAX_INCLUSIVE
facet corresponding to the attribute.java.lang.String
getFacetMaxLengthValue()
Gets the value of theMAX_LENGTH
facet corresponding to the attribute.java.lang.String
getFacetMinExclusiveValue()
Gets the value of theMIN_EXCLUSIVE
facet corresponding to the attribute.java.lang.String
getFacetMinInclusiveValue()
Gets the value of theMIN_INCLUSIVE
facet corresponding to the attribute.java.lang.String
getFacetMinLengthValue()
Gets the value of theMIN_LENGTH
facet corresponding to the attribute.java.lang.String
getFacetPattern()
Gets the value of thePATTERN
facet corresponding to the attribute.java.lang.String
getFacetTotalDigitsValue()
Gets the value of theTOTAL_DIGITS
facet corresponding to the attribute.java.lang.String
getFacetWhitespaceValue()
Gets the value of theWHITESPACE
facet corresponding to the attribute.java.lang.String
getModelDescription()
Gets the model description.java.lang.String
getName()
Gets the QName of the attribute in almost all cases.java.lang.String
getNamespace()
Gets the namespace attribute of the attribute.java.lang.String
getOpenContentMode()
Returns the mode of the open content.java.lang.String
getOpenContentWildcardDescription()
Returns the description for the open content wildcard.java.util.List<java.lang.String>
getPossibleValues()
Gets the possible values this attribute can have.java.lang.String
getPrefix()
Get the attribute prefix.boolean
hasDefaultValue()
Check if has default value attribute of the attribute.int
hashCode()
boolean
isAttributeNameQualified()
Returnstrue
if the name of the attribute is a QName.boolean
isDeclareXmlns()
Check if attribute should add an xmlns declaration.boolean
isFixed()
Find if the attribute is fixed.boolean
isRequired()
Gets the required attribute of the attribute.void
setAnnotation(java.lang.String annotation)
Set the annotation for the attribute.void
setAssertions(java.lang.String assertionsDescription)
Sets the string representation for the node type assertions.void
setDeclareXmlns(boolean declareXmlns)
Set if the attribute should add an xmlns declaration.void
setDefaultValue(java.lang.String defaultValue)
Sets the default value attribute of the attribute.void
setEditableState(CIAttribute.EditableState editableState)
void
setFacetFractionDigitsValue(java.lang.String fractionDigitsFacetValue)
Sets the value of theFRACTION_DIGITS
facet corresponding to the attribute.void
setFacetLengthValue(java.lang.String lengthFacetValue)
Sets the value of theLENGTH
facet corresponding to the attribute.void
setFacetMaxExclusiveValue(java.lang.String maxExclusiveFacetValue)
Sets the value of theMAX_EXCLUSIVE
facet corresponding to the attribute.void
setFacetMaxInclusiveValue(java.lang.String maxInclusiveFacetValue)
Sets the value of theMAX_INCLUSIVE
facet corresponding to the attribute.void
setFacetMaxLengthValue(java.lang.String maxLengthFacetValue)
Sets the value of theMAX_LENGTH
facet corresponding to the attribute.void
setFacetMinExclusiveValue(java.lang.String minExclusiveFacetValue)
Sets the value of theMIN_EXCLUSIVE
facet corresponding to the attribute.void
setFacetMinInclusiveValue(java.lang.String minInclusiveFacetValue)
Sets the value of theMIN_INCLUSIVE
facet corresponding to the attribute.void
setFacetMinLengthValue(java.lang.String minLengthFacetValue)
Sets the value of theMIN_LENGTH
facet corresponding to the attribute.void
setFacetPattern(java.lang.String patternFacets)
Sets the value of thePATTERN
facet corresponding to the attribute.void
setFacetTotalDigitsValue(java.lang.String totalDigitsFacetValue)
Sets the value of theTOTAL_DIGITS
facet corresponding to the attribute.void
setFacetWhitespaceValue(java.lang.String whitespaceFacetValue)
Sets the value of theWHITESPACE
facet corresponding to the attribute.void
setFixed(boolean fixed)
Sets the fixed mode of the attribute.void
setModelDescription(java.lang.String modelDescription)
Sets the model description.void
setName(java.lang.String name)
Sets the local name of the attribute.void
setNamespace(java.lang.String namespace)
Sets the namespace value for the attribute.void
setOpenContentMode(java.lang.String mode)
Sets the mode of the open content.void
setOpenContentWildcardDescription(java.lang.String wildcardDescription)
Sets the description for the open content wildcard.void
setOverridingDefaultValueProvider(CIAttribute.DefaultValueProvider defaultValueProvider)
Sets the default value provider that overrides the default value.void
setPossiblesValues(java.util.List<java.lang.String> possiblesValues)
Sets the possible values this attribute can have.void
setPrefix(java.lang.String prefix)
Set the attribute prefix.void
setRequired(boolean required)
Sets the required value for the attribute.java.lang.String
toString()
-
-
-
Constructor Detail
-
CIAttribute
public CIAttribute()
Default Constructor.
-
CIAttribute
public CIAttribute(java.lang.String name, boolean required, boolean fixed, java.lang.String defaultValue, java.util.List<java.lang.String> possibleValues)
Constructor.- Parameters:
name
- The attribute name.required
-True
if the attribute is required.fixed
-True
if the attribute is fixed.defaultValue
- The default value of the attribute.possibleValues
- The list of possible values for the attribute.
-
CIAttribute
public CIAttribute(java.lang.String namespace, java.lang.String name, boolean required, boolean fixed, java.lang.String defaultValue, java.util.List<java.lang.String> possibleValues)
Constructor.- Parameters:
namespace
- The attribute namespace.name
- The attribute name.required
-True
if the attribute is required.fixed
-True
if the attribute is fixed.defaultValue
- The default value of the attribute.possibleValues
- The list of possible values for the attribute.
-
-
Method Detail
-
getEditableState
public CIAttribute.EditableState getEditableState()
- Returns:
- Returns the editable state.
-
setEditableState
public void setEditableState(CIAttribute.EditableState editableState)
- Parameters:
editableState
- The editable state to set.
-
isFixed
public boolean isFixed()
Find if the attribute is fixed.- Returns:
true
if the attribute is fixed.
-
getName
public java.lang.String getName()
Gets the QName of the attribute in almost all cases. In the case when the namespace of the attribute is not declared, then this method returns the local name. To verify this situation you can use the methodisDeclareXmlns()
.- Specified by:
getName
in interfaceNodeDescription
- Returns:
- The attribute qualified name (QName). The local name is returned when the namespace declaration is missing.
-
setName
public void setName(java.lang.String name)
Sets the local name of the attribute.- Parameters:
name
- The local name of the attribute to be set.
-
getNamespace
public java.lang.String getNamespace()
Gets the namespace attribute of the attribute.- Returns:
- The namespace of the attribute.
-
isRequired
public boolean isRequired()
Gets the required attribute of the attribute.- Returns:
- The required value of the attribute.
-
getDefaultValue
public java.lang.String getDefaultValue()
Gets the default value attribute of the attribute.- Returns:
- The default value or
null
if a default value was not previously set, nor the default value provider was set.
-
hasDefaultValue
public boolean hasDefaultValue()
Check if has default value attribute of the attribute.- Returns:
true
if has default value for attribute.
-
getPossibleValues
public java.util.List<java.lang.String> getPossibleValues()
Gets the possible values this attribute can have.- Specified by:
getPossibleValues
in interfaceNodeDescription
- Returns:
- The list of possible values, or
null
if a possible values list cannot be determined.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
compareTo
public int compareTo(CIAttribute otherAttribute)
Compare two attributes based on the string obtained by concatenating the name and the namespace of each attribute.- Specified by:
compareTo
in interfacejava.lang.Comparable<CIAttribute>
- Parameters:
otherAttribute
- The CIAttribute to compare with.- Returns:
- a negative integer, zero, or a positive integer as this attribute is less than, equal to, or greater than the specified attribute.
-
getFacetFractionDigitsValue
public java.lang.String getFacetFractionDigitsValue()
Gets the value of theFRACTION_DIGITS
facet corresponding to the attribute.- Specified by:
getFacetFractionDigitsValue
in interfaceNodeDescription
- Returns:
- Returns the value of the
FRACTION_DIGITS
facet. Can benull
.
-
setFacetFractionDigitsValue
public void setFacetFractionDigitsValue(java.lang.String fractionDigitsFacetValue)
Sets the value of theFRACTION_DIGITS
facet corresponding to the attribute.- Specified by:
setFacetFractionDigitsValue
in interfaceNodeDescription
- Parameters:
fractionDigitsFacetValue
- The value of theFRACTION_DIGITS
facet to be set.
-
getFacetLengthValue
public java.lang.String getFacetLengthValue()
Gets the value of theLENGTH
facet corresponding to the attribute.- Specified by:
getFacetLengthValue
in interfaceNodeDescription
- Returns:
- Returns the value of the
LENGTH
facet. Can benull
.
-
setFacetLengthValue
public void setFacetLengthValue(java.lang.String lengthFacetValue)
Sets the value of theLENGTH
facet corresponding to the attribute.- Specified by:
setFacetLengthValue
in interfaceNodeDescription
- Parameters:
lengthFacetValue
- The value of theLENGTH
facet to be set.
-
getFacetMaxExclusiveValue
public java.lang.String getFacetMaxExclusiveValue()
Gets the value of theMAX_EXCLUSIVE
facet corresponding to the attribute.- Specified by:
getFacetMaxExclusiveValue
in interfaceNodeDescription
- Returns:
- Returns the value of the
MAX_EXCLUSIVE
facet. Can benull
.
-
setFacetMaxExclusiveValue
public void setFacetMaxExclusiveValue(java.lang.String maxExclusiveFacetValue)
Sets the value of theMAX_EXCLUSIVE
facet corresponding to the attribute.- Specified by:
setFacetMaxExclusiveValue
in interfaceNodeDescription
- Parameters:
maxExclusiveFacetValue
- The value of theMAX_EXCLUSIVE
facet to be set.
-
getFacetMaxInclusiveValue
public java.lang.String getFacetMaxInclusiveValue()
Gets the value of theMAX_INCLUSIVE
facet corresponding to the attribute.- Specified by:
getFacetMaxInclusiveValue
in interfaceNodeDescription
- Returns:
- Returns the value of the
MAX_INCLUSIVE
facet. Can benull
.
-
setFacetMaxInclusiveValue
public void setFacetMaxInclusiveValue(java.lang.String maxInclusiveFacetValue)
Sets the value of theMAX_INCLUSIVE
facet corresponding to the attribute.- Specified by:
setFacetMaxInclusiveValue
in interfaceNodeDescription
- Parameters:
maxInclusiveFacetValue
- The value of theMAX_INCLUSIVE
facet to be set.
-
getFacetMaxLengthValue
public java.lang.String getFacetMaxLengthValue()
Gets the value of theMAX_LENGTH
facet corresponding to the attribute.- Specified by:
getFacetMaxLengthValue
in interfaceNodeDescription
- Returns:
- Returns the value of the
MAX_LENGTH
facet. Can benull
.
-
setFacetMaxLengthValue
public void setFacetMaxLengthValue(java.lang.String maxLengthFacetValue)
Sets the value of theMAX_LENGTH
facet corresponding to the attribute.- Specified by:
setFacetMaxLengthValue
in interfaceNodeDescription
- Parameters:
maxLengthFacetValue
- The value of theMAX_LENGTH
facet to be set.
-
getFacetMinExclusiveValue
public java.lang.String getFacetMinExclusiveValue()
Gets the value of theMIN_EXCLUSIVE
facet corresponding to the attribute.- Specified by:
getFacetMinExclusiveValue
in interfaceNodeDescription
- Returns:
- Returns the value of the
MIN_EXCLUSIVE
facet. Can benull
.
-
setFacetMinExclusiveValue
public void setFacetMinExclusiveValue(java.lang.String minExclusiveFacetValue)
Sets the value of theMIN_EXCLUSIVE
facet corresponding to the attribute.- Specified by:
setFacetMinExclusiveValue
in interfaceNodeDescription
- Parameters:
minExclusiveFacetValue
- The value of theMIN_EXCLUSIVE
facet to be set.
-
getFacetMinInclusiveValue
public java.lang.String getFacetMinInclusiveValue()
Gets the value of theMIN_INCLUSIVE
facet corresponding to the attribute.- Specified by:
getFacetMinInclusiveValue
in interfaceNodeDescription
- Returns:
- Returns the value of the
MIN_INCLUSIVE
facet. Can benull
.
-
setFacetMinInclusiveValue
public void setFacetMinInclusiveValue(java.lang.String minInclusiveFacetValue)
Sets the value of theMIN_INCLUSIVE
facet corresponding to the attribute.- Specified by:
setFacetMinInclusiveValue
in interfaceNodeDescription
- Parameters:
minInclusiveFacetValue
- The value of theMIN_INCLUSIVE
facet to be set.
-
getFacetMinLengthValue
public java.lang.String getFacetMinLengthValue()
Gets the value of theMIN_LENGTH
facet corresponding to the attribute.- Specified by:
getFacetMinLengthValue
in interfaceNodeDescription
- Returns:
- Returns the value of the
MIN_LENGTH
facet. Can benull
.
-
setFacetMinLengthValue
public void setFacetMinLengthValue(java.lang.String minLengthFacetValue)
Sets the value of theMIN_LENGTH
facet corresponding to the attribute.- Specified by:
setFacetMinLengthValue
in interfaceNodeDescription
- Parameters:
minLengthFacetValue
- The value of theMIN_LENGTH
facet to be set.
-
getFacetTotalDigitsValue
public java.lang.String getFacetTotalDigitsValue()
Gets the value of theTOTAL_DIGITS
facet corresponding to the attribute.- Specified by:
getFacetTotalDigitsValue
in interfaceNodeDescription
- Returns:
- Returns the value of the
TOTAL_DIGITS
facet. Can benull
.
-
setFacetTotalDigitsValue
public void setFacetTotalDigitsValue(java.lang.String totalDigitsFacetValue)
Sets the value of theTOTAL_DIGITS
facet corresponding to the attribute.- Specified by:
setFacetTotalDigitsValue
in interfaceNodeDescription
- Parameters:
totalDigitsFacetValue
- The value of theTOTAL_DIGITS
facet to be set.
-
getFacetWhitespaceValue
public java.lang.String getFacetWhitespaceValue()
Gets the value of theWHITESPACE
facet corresponding to the attribute.- Specified by:
getFacetWhitespaceValue
in interfaceNodeDescription
- Returns:
- Returns the value of the
WHITESPACE
facet. Can benull
.
-
setFacetWhitespaceValue
public void setFacetWhitespaceValue(java.lang.String whitespaceFacetValue)
Sets the value of theWHITESPACE
facet corresponding to the attribute.- Specified by:
setFacetWhitespaceValue
in interfaceNodeDescription
- Parameters:
whitespaceFacetValue
- The value of theWHITESPACE
facet to be set.
-
getFacetPattern
public java.lang.String getFacetPattern()
Gets the value of thePATTERN
facet corresponding to the attribute.- Specified by:
getFacetPattern
in interfaceNodeDescription
- Returns:
- Returns the value of the
PATTERN
facet. Can benull
.
-
setFacetPattern
public void setFacetPattern(java.lang.String patternFacets)
Sets the value of thePATTERN
facet corresponding to the attribute.- Specified by:
setFacetPattern
in interfaceNodeDescription
- Parameters:
patternFacets
- The value of thePATTERN
facet to be set.
-
getModelDescription
public java.lang.String getModelDescription()
Gets the model description.- Specified by:
getModelDescription
in interfaceNodeDescription
- Returns:
- Returns the attribute model description.
Can be
null
.
-
setModelDescription
public void setModelDescription(java.lang.String modelDescription)
Sets the model description.- Specified by:
setModelDescription
in interfaceNodeDescription
- Parameters:
modelDescription
- The model description of the attribute to be set.
-
setDefaultValue
public void setDefaultValue(java.lang.String defaultValue)
Sets the default value attribute of the attribute.- Parameters:
defaultValue
- The default value of the attribute.
-
setOverridingDefaultValueProvider
public void setOverridingDefaultValueProvider(CIAttribute.DefaultValueProvider defaultValueProvider)
Sets the default value provider that overrides the default value.- Parameters:
defaultValueProvider
- The default value provider.
-
setPossiblesValues
public void setPossiblesValues(java.util.List<java.lang.String> possiblesValues)
Sets the possible values this attribute can have.- Specified by:
setPossiblesValues
in interfaceNodeDescription
- Parameters:
possiblesValues
- The list of possible values to set.- See Also:
NodeDescription.setPossiblesValues(java.util.List)
-
setRequired
public void setRequired(boolean required)
Sets the required value for the attribute.- Parameters:
required
- Iftrue
the attribute is required.
-
setNamespace
public void setNamespace(java.lang.String namespace)
Sets the namespace value for the attribute.- Parameters:
namespace
- The namespace to be set.
-
setFixed
public void setFixed(boolean fixed)
Sets the fixed mode of the attribute.- Parameters:
fixed
- True if the attribute has a fixed value.
-
getAnnotation
public java.lang.String getAnnotation()
Get the annotation for the attribute.- Specified by:
getAnnotation
in interfaceNodeDescription
- Returns:
- A text that explains how to use the attribute, or
null
.
-
setAnnotation
public void setAnnotation(java.lang.String annotation)
Set the annotation for the attribute.- Parameters:
annotation
- The annotation of the attribute, ornull
.
-
isDeclareXmlns
public boolean isDeclareXmlns()
Check if attribute should add an xmlns declaration.- Returns:
- Returns
true
if attribute should add an xmlns declaration.
-
setDeclareXmlns
public void setDeclareXmlns(boolean declareXmlns)
Set if the attribute should add an xmlns declaration.- Parameters:
declareXmlns
-true
if the attribute should add an xmlns declaration.
-
getPrefix
public java.lang.String getPrefix()
Get the attribute prefix.- Returns:
- Returns the prefix.
-
setPrefix
public void setPrefix(java.lang.String prefix)
Set the attribute prefix.- Parameters:
prefix
- The prefix to set.
-
setAssertions
public void setAssertions(java.lang.String assertionsDescription)
Description copied from interface:NodeDescription
Sets the string representation for the node type assertions.- Specified by:
setAssertions
in interfaceNodeDescription
- Parameters:
assertionsDescription
- The string representing all assertions.- See Also:
NodeDescription.setAssertions(String)
-
getAssertions
public java.lang.String getAssertions()
Description copied from interface:NodeDescription
Returns the string representation for all assertions. The assertions are collected from node type, by example for simple types they are collected using assertion facets. The representation is (assertion1) && (assertion2) && etc.- Specified by:
getAssertions
in interfaceNodeDescription
- Returns:
- The string containing all assertions. Is null if node type does not have any assertion.
- See Also:
NodeDescription.getAssertions()
-
setOpenContentMode
public void setOpenContentMode(java.lang.String mode)
Description copied from interface:NodeDescription
Sets the mode of the open content. Can be one of 'interleave', 'suffix' or 'none'.- Specified by:
setOpenContentMode
in interfaceNodeDescription
- Parameters:
mode
- The mode of the open content.- See Also:
NodeDescription.setOpenContentMode(java.lang.String)
-
getOpenContentMode
public java.lang.String getOpenContentMode()
Description copied from interface:NodeDescription
Returns the mode of the open content. Null if element type does not contains an open content.- Specified by:
getOpenContentMode
in interfaceNodeDescription
- Returns:
- The mode of the open content.
- See Also:
NodeDescription.getOpenContentMode()
-
setOpenContentWildcardDescription
public void setOpenContentWildcardDescription(java.lang.String wildcardDescription)
Description copied from interface:NodeDescription
Sets the description for the open content wildcard.- Specified by:
setOpenContentWildcardDescription
in interfaceNodeDescription
- Parameters:
wildcardDescription
- The wildcard description.- See Also:
NodeDescription.setOpenContentWildcardDescription(java.lang.String)
-
getOpenContentWildcardDescription
public java.lang.String getOpenContentWildcardDescription()
Description copied from interface:NodeDescription
Returns the description for the open content wildcard.- Specified by:
getOpenContentWildcardDescription
in interfaceNodeDescription
- Returns:
- The description for the open content wildcard. Null if wildcard is missing.
- See Also:
NodeDescription.getOpenContentWildcardDescription()
-
isAttributeNameQualified
public boolean isAttributeNameQualified()
Returnstrue
if the name of the attribute is a QName. This means that it already contains the prefix before the local name.- Returns:
true
if the attribute name is actually a QName.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Allows cloning.- Overrides:
clone
in classjava.lang.Object
- Throws:
java.lang.CloneNotSupportedException
- See Also:
Object.clone()
-
-