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.
  • 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 - 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(String namespace, String name, boolean required, boolean fixed, String defaultValue, List<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 Details

    • 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 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 method isDeclareXmlns().
      Specified by:
      getName in interface NodeDescription
      Returns:
      The attribute qualified name (QName). The local name is returned when the namespace declaration is missing.
    • setName

      public void setName(String name)
      Sets the local name of the attribute.
      Parameters:
      name - The local name of the attribute to be set.
    • getNamespace

      public 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 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 List<String> getPossibleValues()
      Gets the possible values this attribute can have.
      Specified by:
      getPossibleValues in interface NodeDescription
      Returns:
      The list of possible values, or null if a possible values list cannot be determined.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • 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 interface 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 String getFacetFractionDigitsValue()
      Gets the value of the FRACTION_DIGITS facet corresponding to the attribute.
      Specified by:
      getFacetFractionDigitsValue in interface NodeDescription
      Returns:
      Returns the value of the FRACTION_DIGITS facet. Can be null.
    • setFacetFractionDigitsValue

      public void setFacetFractionDigitsValue(String fractionDigitsFacetValue)
      Sets the value of the FRACTION_DIGITS facet corresponding to the attribute.
      Specified by:
      setFacetFractionDigitsValue in interface NodeDescription
      Parameters:
      fractionDigitsFacetValue - The value of the FRACTION_DIGITS facet to be set.
    • getFacetLengthValue

      public String getFacetLengthValue()
      Gets the value of the LENGTH facet corresponding to the attribute.
      Specified by:
      getFacetLengthValue in interface NodeDescription
      Returns:
      Returns the value of the LENGTH facet. Can be null.
    • setFacetLengthValue

      public void setFacetLengthValue(String lengthFacetValue)
      Sets the value of the LENGTH facet corresponding to the attribute.
      Specified by:
      setFacetLengthValue in interface NodeDescription
      Parameters:
      lengthFacetValue - The value of the LENGTH facet to be set.
    • getFacetMaxExclusiveValue

      public String getFacetMaxExclusiveValue()
      Gets the value of the MAX_EXCLUSIVE facet corresponding to the attribute.
      Specified by:
      getFacetMaxExclusiveValue in interface NodeDescription
      Returns:
      Returns the value of the MAX_EXCLUSIVE facet. Can be null.
    • setFacetMaxExclusiveValue

      public void setFacetMaxExclusiveValue(String maxExclusiveFacetValue)
      Sets the value of the MAX_EXCLUSIVE facet corresponding to the attribute.
      Specified by:
      setFacetMaxExclusiveValue in interface NodeDescription
      Parameters:
      maxExclusiveFacetValue - The value of the MAX_EXCLUSIVE facet to be set.
    • getFacetMaxInclusiveValue

      public String getFacetMaxInclusiveValue()
      Gets the value of the MAX_INCLUSIVE facet corresponding to the attribute.
      Specified by:
      getFacetMaxInclusiveValue in interface NodeDescription
      Returns:
      Returns the value of the MAX_INCLUSIVE facet. Can be null.
    • setFacetMaxInclusiveValue

      public void setFacetMaxInclusiveValue(String maxInclusiveFacetValue)
      Sets the value of the MAX_INCLUSIVE facet corresponding to the attribute.
      Specified by:
      setFacetMaxInclusiveValue in interface NodeDescription
      Parameters:
      maxInclusiveFacetValue - The value of the MAX_INCLUSIVE facet to be set.
    • getFacetMaxLengthValue

      public String getFacetMaxLengthValue()
      Gets the value of the MAX_LENGTH facet corresponding to the attribute.
      Specified by:
      getFacetMaxLengthValue in interface NodeDescription
      Returns:
      Returns the value of the MAX_LENGTH facet. Can be null.
    • setFacetMaxLengthValue

      public void setFacetMaxLengthValue(String maxLengthFacetValue)
      Sets the value of the MAX_LENGTH facet corresponding to the attribute.
      Specified by:
      setFacetMaxLengthValue in interface NodeDescription
      Parameters:
      maxLengthFacetValue - The value of the MAX_LENGTH facet to be set.
    • getFacetMinExclusiveValue

      public String getFacetMinExclusiveValue()
      Gets the value of the MIN_EXCLUSIVE facet corresponding to the attribute.
      Specified by:
      getFacetMinExclusiveValue in interface NodeDescription
      Returns:
      Returns the value of the MIN_EXCLUSIVE facet. Can be null.
    • setFacetMinExclusiveValue

      public void setFacetMinExclusiveValue(String minExclusiveFacetValue)
      Sets the value of the MIN_EXCLUSIVE facet corresponding to the attribute.
      Specified by:
      setFacetMinExclusiveValue in interface NodeDescription
      Parameters:
      minExclusiveFacetValue - The value of the MIN_EXCLUSIVE facet to be set.
    • getFacetMinInclusiveValue

      public String getFacetMinInclusiveValue()
      Gets the value of the MIN_INCLUSIVE facet corresponding to the attribute.
      Specified by:
      getFacetMinInclusiveValue in interface NodeDescription
      Returns:
      Returns the value of the MIN_INCLUSIVE facet. Can be null.
    • setFacetMinInclusiveValue

      public void setFacetMinInclusiveValue(String minInclusiveFacetValue)
      Sets the value of the MIN_INCLUSIVE facet corresponding to the attribute.
      Specified by:
      setFacetMinInclusiveValue in interface NodeDescription
      Parameters:
      minInclusiveFacetValue - The value of the MIN_INCLUSIVE facet to be set.
    • getFacetMinLengthValue

      public String getFacetMinLengthValue()
      Gets the value of the MIN_LENGTH facet corresponding to the attribute.
      Specified by:
      getFacetMinLengthValue in interface NodeDescription
      Returns:
      Returns the value of the MIN_LENGTH facet. Can be null.
    • setFacetMinLengthValue

      public void setFacetMinLengthValue(String minLengthFacetValue)
      Sets the value of the MIN_LENGTH facet corresponding to the attribute.
      Specified by:
      setFacetMinLengthValue in interface NodeDescription
      Parameters:
      minLengthFacetValue - The value of the MIN_LENGTH facet to be set.
    • getFacetTotalDigitsValue

      public String getFacetTotalDigitsValue()
      Gets the value of the TOTAL_DIGITS facet corresponding to the attribute.
      Specified by:
      getFacetTotalDigitsValue in interface NodeDescription
      Returns:
      Returns the value of the TOTAL_DIGITS facet. Can be null.
    • setFacetTotalDigitsValue

      public void setFacetTotalDigitsValue(String totalDigitsFacetValue)
      Sets the value of the TOTAL_DIGITS facet corresponding to the attribute.
      Specified by:
      setFacetTotalDigitsValue in interface NodeDescription
      Parameters:
      totalDigitsFacetValue - The value of the TOTAL_DIGITS facet to be set.
    • getFacetWhitespaceValue

      public String getFacetWhitespaceValue()
      Gets the value of the WHITESPACE facet corresponding to the attribute.
      Specified by:
      getFacetWhitespaceValue in interface NodeDescription
      Returns:
      Returns the value of the WHITESPACE facet. Can be null.
    • setFacetWhitespaceValue

      public void setFacetWhitespaceValue(String whitespaceFacetValue)
      Sets the value of the WHITESPACE facet corresponding to the attribute.
      Specified by:
      setFacetWhitespaceValue in interface NodeDescription
      Parameters:
      whitespaceFacetValue - The value of the WHITESPACE facet to be set.
    • getFacetPattern

      public String getFacetPattern()
      Gets the value of the PATTERN facet corresponding to the attribute.
      Specified by:
      getFacetPattern in interface NodeDescription
      Returns:
      Returns the value of the PATTERN facet. Can be null.
    • setFacetPattern

      public void setFacetPattern(String patternFacets)
      Sets the value of the PATTERN facet corresponding to the attribute.
      Specified by:
      setFacetPattern in interface NodeDescription
      Parameters:
      patternFacets - The value of the PATTERN facet to be set.
    • getModelDescription

      public String getModelDescription()
      Gets the model description.
      Specified by:
      getModelDescription in interface NodeDescription
      Returns:
      Returns the attribute model description. Can be null.
    • setModelDescription

      public void setModelDescription(String modelDescription)
      Sets the model description.
      Specified by:
      setModelDescription in interface NodeDescription
      Parameters:
      modelDescription - The model description of the attribute to be set.
    • setDefaultValue

      public void setDefaultValue(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(List<String> possiblesValues)
      Sets the possible values this attribute can have.
      Specified by:
      setPossiblesValues in interface NodeDescription
      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 - If true the attribute is required.
    • setNamespace

      public void setNamespace(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 String getAnnotation()
      Get the annotation for the attribute.
      Specified by:
      getAnnotation in interface NodeDescription
      Returns:
      A text that explains how to use the attribute, or null.
    • setAnnotation

      public void setAnnotation(String annotation)
      Set the annotation for the attribute.
      Parameters:
      annotation - The annotation of the attribute, or null.
    • 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 String getPrefix()
      Get the attribute prefix.
      Returns:
      Returns the prefix.
    • setPrefix

      public void setPrefix(String prefix)
      Set the attribute prefix.
      Parameters:
      prefix - The prefix to set.
    • setAssertions

      public void setAssertions(String assertionsDescription)
      Description copied from interface: NodeDescription
      Sets the string representation for the node type assertions.
      Specified by:
      setAssertions in interface NodeDescription
      Parameters:
      assertionsDescription - The string representing all assertions.
      See Also:
    • getAssertions

      public 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 interface NodeDescription
      Returns:
      The string containing all assertions. Is null if node type does not have any assertion.
      See Also:
    • setOpenContentMode

      public void setOpenContentMode(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 interface NodeDescription
      Parameters:
      mode - The mode of the open content.
      See Also:
    • getOpenContentMode

      public 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 interface NodeDescription
      Returns:
      The mode of the open content.
      See Also:
    • setOpenContentWildcardDescription

      public void setOpenContentWildcardDescription(String wildcardDescription)
      Description copied from interface: NodeDescription
      Sets the description for the open content wildcard.
      Specified by:
      setOpenContentWildcardDescription in interface NodeDescription
      Parameters:
      wildcardDescription - The wildcard description.
      See Also:
    • getOpenContentWildcardDescription

      public String getOpenContentWildcardDescription()
      Description copied from interface: NodeDescription
      Returns the description for the open content wildcard.
      Specified by:
      getOpenContentWildcardDescription in interface NodeDescription
      Returns:
      The description for the open content wildcard. Null if wildcard is missing.
      See Also:
    • isAttributeNameQualified

      public boolean isAttributeNameQualified()
      Returns true 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 Object clone() throws CloneNotSupportedException
      Allows cloning.
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
      See Also: