Package ro.sync.contentcompletion.xml
Class CIAttribute
java.lang.Object
ro.sync.contentcompletion.xml.CIAttribute
- All Implemented Interfaces:
Cloneable,Comparable<CIAttribute>,NodeDescription
@API(type=NOT_EXTENDABLE,
src=PRIVATE)
public class CIAttribute
extends Object
implements Comparable<CIAttribute>, NodeDescription, Cloneable
Interface for objects holding information about attributes
used in the content completion process.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDefault value provider for an attribute.static enumThe editable state of the attribute. -
Constructor Summary
ConstructorsConstructorDescriptionDefault Constructor.CIAttribute(String name, boolean required, boolean fixed, String defaultValue, List<String> possibleValues) Constructor.CIAttribute(String namespace, String name, boolean required, boolean fixed, String defaultValue, List<String> possibleValues) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionclone()Allows cloning.intcompareTo(CIAttribute otherAttribute) Compare two attributes based on the string obtained by concatenating the name and the namespace of each attribute.booleanGet the annotation for the attribute.Returns the string representation for all assertions.Gets the default value attribute of the attribute.Gets the value of theFRACTION_DIGITSfacet corresponding to the attribute.Gets the value of theLENGTHfacet corresponding to the attribute.Gets the value of theMAX_EXCLUSIVEfacet corresponding to the attribute.Gets the value of theMAX_INCLUSIVEfacet corresponding to the attribute.Gets the value of theMAX_LENGTHfacet corresponding to the attribute.Gets the value of theMIN_EXCLUSIVEfacet corresponding to the attribute.Gets the value of theMIN_INCLUSIVEfacet corresponding to the attribute.Gets the value of theMIN_LENGTHfacet corresponding to the attribute.Gets the value of thePATTERNfacet corresponding to the attribute.Gets the value of theTOTAL_DIGITSfacet corresponding to the attribute.Gets the value of theWHITESPACEfacet corresponding to the attribute.Gets the model description.getName()Gets the QName of the attribute in almost all cases.Gets the namespace attribute of the attribute.Returns the mode of the open content.Returns the description for the open content wildcard.Gets the possible values this attribute can have.Get the attribute prefix.booleanCheck if has default value attribute of the attribute.inthashCode()booleanReturnstrueif the name of the attribute is a QName.booleanCheck if attribute should add an xmlns declaration.booleanisFixed()Find if the attribute is fixed.booleanGets the required attribute of the attribute.voidsetAnnotation(String annotation) Set the annotation for the attribute.voidsetAssertions(String assertionsDescription) Sets the string representation for the node type assertions.voidsetDeclareXmlns(boolean declareXmlns) Set if the attribute should add an xmlns declaration.voidsetDefaultValue(String defaultValue) Sets the default value attribute of the attribute.voidsetEditableState(CIAttribute.EditableState editableState) voidsetFacetFractionDigitsValue(String fractionDigitsFacetValue) Sets the value of theFRACTION_DIGITSfacet corresponding to the attribute.voidsetFacetLengthValue(String lengthFacetValue) Sets the value of theLENGTHfacet corresponding to the attribute.voidsetFacetMaxExclusiveValue(String maxExclusiveFacetValue) Sets the value of theMAX_EXCLUSIVEfacet corresponding to the attribute.voidsetFacetMaxInclusiveValue(String maxInclusiveFacetValue) Sets the value of theMAX_INCLUSIVEfacet corresponding to the attribute.voidsetFacetMaxLengthValue(String maxLengthFacetValue) Sets the value of theMAX_LENGTHfacet corresponding to the attribute.voidsetFacetMinExclusiveValue(String minExclusiveFacetValue) Sets the value of theMIN_EXCLUSIVEfacet corresponding to the attribute.voidsetFacetMinInclusiveValue(String minInclusiveFacetValue) Sets the value of theMIN_INCLUSIVEfacet corresponding to the attribute.voidsetFacetMinLengthValue(String minLengthFacetValue) Sets the value of theMIN_LENGTHfacet corresponding to the attribute.voidsetFacetPattern(String patternFacets) Sets the value of thePATTERNfacet corresponding to the attribute.voidsetFacetTotalDigitsValue(String totalDigitsFacetValue) Sets the value of theTOTAL_DIGITSfacet corresponding to the attribute.voidsetFacetWhitespaceValue(String whitespaceFacetValue) Sets the value of theWHITESPACEfacet corresponding to the attribute.voidsetFixed(boolean fixed) Sets the fixed mode of the attribute.voidsetModelDescription(String modelDescription) Sets the model description.voidSets the local name of the attribute.voidsetNamespace(String namespace) Sets the namespace value for the attribute.voidsetOpenContentMode(String mode) Sets the mode of the open content.voidsetOpenContentWildcardDescription(String wildcardDescription) Sets the description for the open content wildcard.voidsetOverridingDefaultValueProvider(CIAttribute.DefaultValueProvider defaultValueProvider) Sets the default value provider that overrides the default value.voidsetPossiblesValues(List<String> possiblesValues) Sets the possible values this attribute can have.voidSet the attribute prefix.voidsetRequired(boolean required) Sets the required value for the attribute.toString()
-
Constructor Details
-
CIAttribute
public CIAttribute()Default Constructor. -
CIAttribute
public CIAttribute(String name, boolean required, boolean fixed, String defaultValue, List<String> possibleValues) Constructor.- Parameters:
name- The attribute name.required-Trueif the attribute is required.fixed-Trueif the attribute is fixed.defaultValue- The default value of the attribute.possibleValues- The list of possible values for the attribute.
-
CIAttribute
public CIAttribute(String namespace, String name, boolean required, boolean fixed, String defaultValue, List<String> possibleValues) Constructor.- Parameters:
namespace- The attribute namespace.name- The attribute name.required-Trueif the attribute is required.fixed-Trueif the attribute is fixed.defaultValue- The default value of the attribute.possibleValues- The list of possible values for the attribute.
-
-
Method Details
-
getEditableState
- Returns:
- Returns the editable state.
-
setEditableState
- Parameters:
editableState- The editable state to set.
-
isFixed
public boolean isFixed()Find if the attribute is fixed.- Returns:
trueif the attribute is fixed.
-
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:
getNamein interfaceNodeDescription- Returns:
- The attribute qualified name (QName). The local name is returned when the namespace declaration is missing.
-
setName
Sets the local name of the attribute.- Parameters:
name- The local name of the attribute to be set.
-
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
Gets the default value attribute of the attribute.- Returns:
- The default value or
nullif 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:
trueif has default value for attribute.
-
getPossibleValues
Gets the possible values this attribute can have.- Specified by:
getPossibleValuesin interfaceNodeDescription- Returns:
- The list of possible values, or
nullif a possible values list cannot be determined.
-
equals
-
hashCode
public int hashCode() -
toString
-
compareTo
Compare two attributes based on the string obtained by concatenating the name and the namespace of each attribute.- Specified by:
compareToin interfaceComparable<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
Gets the value of theFRACTION_DIGITSfacet corresponding to the attribute.- Specified by:
getFacetFractionDigitsValuein interfaceNodeDescription- Returns:
- Returns the value of the
FRACTION_DIGITSfacet. Can benull.
-
setFacetFractionDigitsValue
Sets the value of theFRACTION_DIGITSfacet corresponding to the attribute.- Specified by:
setFacetFractionDigitsValuein interfaceNodeDescription- Parameters:
fractionDigitsFacetValue- The value of theFRACTION_DIGITSfacet to be set.
-
getFacetLengthValue
Gets the value of theLENGTHfacet corresponding to the attribute.- Specified by:
getFacetLengthValuein interfaceNodeDescription- Returns:
- Returns the value of the
LENGTHfacet. Can benull.
-
setFacetLengthValue
Sets the value of theLENGTHfacet corresponding to the attribute.- Specified by:
setFacetLengthValuein interfaceNodeDescription- Parameters:
lengthFacetValue- The value of theLENGTHfacet to be set.
-
getFacetMaxExclusiveValue
Gets the value of theMAX_EXCLUSIVEfacet corresponding to the attribute.- Specified by:
getFacetMaxExclusiveValuein interfaceNodeDescription- Returns:
- Returns the value of the
MAX_EXCLUSIVEfacet. Can benull.
-
setFacetMaxExclusiveValue
Sets the value of theMAX_EXCLUSIVEfacet corresponding to the attribute.- Specified by:
setFacetMaxExclusiveValuein interfaceNodeDescription- Parameters:
maxExclusiveFacetValue- The value of theMAX_EXCLUSIVEfacet to be set.
-
getFacetMaxInclusiveValue
Gets the value of theMAX_INCLUSIVEfacet corresponding to the attribute.- Specified by:
getFacetMaxInclusiveValuein interfaceNodeDescription- Returns:
- Returns the value of the
MAX_INCLUSIVEfacet. Can benull.
-
setFacetMaxInclusiveValue
Sets the value of theMAX_INCLUSIVEfacet corresponding to the attribute.- Specified by:
setFacetMaxInclusiveValuein interfaceNodeDescription- Parameters:
maxInclusiveFacetValue- The value of theMAX_INCLUSIVEfacet to be set.
-
getFacetMaxLengthValue
Gets the value of theMAX_LENGTHfacet corresponding to the attribute.- Specified by:
getFacetMaxLengthValuein interfaceNodeDescription- Returns:
- Returns the value of the
MAX_LENGTHfacet. Can benull.
-
setFacetMaxLengthValue
Sets the value of theMAX_LENGTHfacet corresponding to the attribute.- Specified by:
setFacetMaxLengthValuein interfaceNodeDescription- Parameters:
maxLengthFacetValue- The value of theMAX_LENGTHfacet to be set.
-
getFacetMinExclusiveValue
Gets the value of theMIN_EXCLUSIVEfacet corresponding to the attribute.- Specified by:
getFacetMinExclusiveValuein interfaceNodeDescription- Returns:
- Returns the value of the
MIN_EXCLUSIVEfacet. Can benull.
-
setFacetMinExclusiveValue
Sets the value of theMIN_EXCLUSIVEfacet corresponding to the attribute.- Specified by:
setFacetMinExclusiveValuein interfaceNodeDescription- Parameters:
minExclusiveFacetValue- The value of theMIN_EXCLUSIVEfacet to be set.
-
getFacetMinInclusiveValue
Gets the value of theMIN_INCLUSIVEfacet corresponding to the attribute.- Specified by:
getFacetMinInclusiveValuein interfaceNodeDescription- Returns:
- Returns the value of the
MIN_INCLUSIVEfacet. Can benull.
-
setFacetMinInclusiveValue
Sets the value of theMIN_INCLUSIVEfacet corresponding to the attribute.- Specified by:
setFacetMinInclusiveValuein interfaceNodeDescription- Parameters:
minInclusiveFacetValue- The value of theMIN_INCLUSIVEfacet to be set.
-
getFacetMinLengthValue
Gets the value of theMIN_LENGTHfacet corresponding to the attribute.- Specified by:
getFacetMinLengthValuein interfaceNodeDescription- Returns:
- Returns the value of the
MIN_LENGTHfacet. Can benull.
-
setFacetMinLengthValue
Sets the value of theMIN_LENGTHfacet corresponding to the attribute.- Specified by:
setFacetMinLengthValuein interfaceNodeDescription- Parameters:
minLengthFacetValue- The value of theMIN_LENGTHfacet to be set.
-
getFacetTotalDigitsValue
Gets the value of theTOTAL_DIGITSfacet corresponding to the attribute.- Specified by:
getFacetTotalDigitsValuein interfaceNodeDescription- Returns:
- Returns the value of the
TOTAL_DIGITSfacet. Can benull.
-
setFacetTotalDigitsValue
Sets the value of theTOTAL_DIGITSfacet corresponding to the attribute.- Specified by:
setFacetTotalDigitsValuein interfaceNodeDescription- Parameters:
totalDigitsFacetValue- The value of theTOTAL_DIGITSfacet to be set.
-
getFacetWhitespaceValue
Gets the value of theWHITESPACEfacet corresponding to the attribute.- Specified by:
getFacetWhitespaceValuein interfaceNodeDescription- Returns:
- Returns the value of the
WHITESPACEfacet. Can benull.
-
setFacetWhitespaceValue
Sets the value of theWHITESPACEfacet corresponding to the attribute.- Specified by:
setFacetWhitespaceValuein interfaceNodeDescription- Parameters:
whitespaceFacetValue- The value of theWHITESPACEfacet to be set.
-
getFacetPattern
Gets the value of thePATTERNfacet corresponding to the attribute.- Specified by:
getFacetPatternin interfaceNodeDescription- Returns:
- Returns the value of the
PATTERNfacet. Can benull.
-
setFacetPattern
Sets the value of thePATTERNfacet corresponding to the attribute.- Specified by:
setFacetPatternin interfaceNodeDescription- Parameters:
patternFacets- The value of thePATTERNfacet to be set.
-
getModelDescription
Gets the model description.- Specified by:
getModelDescriptionin interfaceNodeDescription- Returns:
- Returns the attribute model description.
Can be
null.
-
setModelDescription
Sets the model description.- Specified by:
setModelDescriptionin interfaceNodeDescription- Parameters:
modelDescription- The model description of the attribute to be set.
-
setDefaultValue
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
Sets the possible values this attribute can have.- Specified by:
setPossiblesValuesin interfaceNodeDescription- Parameters:
possiblesValues- The list of possible values to set.- See Also:
-
setRequired
public void setRequired(boolean required) Sets the required value for the attribute.- Parameters:
required- Iftruethe attribute is required.
-
setNamespace
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
Get the annotation for the attribute.- Specified by:
getAnnotationin interfaceNodeDescription- Returns:
- A text that explains how to use the attribute, or
null.
-
setAnnotation
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
trueif attribute should add an xmlns declaration.
-
setDeclareXmlns
public void setDeclareXmlns(boolean declareXmlns) Set if the attribute should add an xmlns declaration.- Parameters:
declareXmlns-trueif the attribute should add an xmlns declaration.
-
getPrefix
Get the attribute prefix.- Returns:
- Returns the prefix.
-
setPrefix
Set the attribute prefix.- Parameters:
prefix- The prefix to set.
-
setAssertions
Description copied from interface:NodeDescriptionSets the string representation for the node type assertions.- Specified by:
setAssertionsin interfaceNodeDescription- Parameters:
assertionsDescription- The string representing all assertions.- See Also:
-
getAssertions
Description copied from interface:NodeDescriptionReturns 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:
getAssertionsin interfaceNodeDescription- Returns:
- The string containing all assertions. Is null if node type does not have any assertion.
- See Also:
-
setOpenContentMode
Description copied from interface:NodeDescriptionSets the mode of the open content. Can be one of 'interleave', 'suffix' or 'none'.- Specified by:
setOpenContentModein interfaceNodeDescription- Parameters:
mode- The mode of the open content.- See Also:
-
getOpenContentMode
Description copied from interface:NodeDescriptionReturns the mode of the open content. Null if element type does not contains an open content.- Specified by:
getOpenContentModein interfaceNodeDescription- Returns:
- The mode of the open content.
- See Also:
-
setOpenContentWildcardDescription
Description copied from interface:NodeDescriptionSets the description for the open content wildcard.- Specified by:
setOpenContentWildcardDescriptionin interfaceNodeDescription- Parameters:
wildcardDescription- The wildcard description.- See Also:
-
getOpenContentWildcardDescription
Description copied from interface:NodeDescriptionReturns the description for the open content wildcard.- Specified by:
getOpenContentWildcardDescriptionin interfaceNodeDescription- Returns:
- The description for the open content wildcard. Null if wildcard is missing.
- See Also:
-
isAttributeNameQualified
public boolean isAttributeNameQualified()Returnstrueif the name of the attribute is a QName. This means that it already contains the prefix before the local name.- Returns:
trueif the attribute name is actually a QName.
-
clone
Allows cloning.- Overrides:
clonein classObject- Throws:
CloneNotSupportedException- See Also:
-