Package ro.sync.contentcompletion.xml
Class CIElementAdapter
java.lang.Object
ro.sync.contentcompletion.xml.CIElementAdapter
- All Implemented Interfaces:
Comparable<CIElement>
,CIElement
,NodeDescription
@API(type=EXTENDABLE,
src=PRIVATE)
public class CIElementAdapter
extends Object
implements CIElement
A
CIElement
adapter.
Simplifies the implementation.-
Field Summary
Fields inherited from interface ro.sync.contentcompletion.xml.CIElement
CONTENT_TYPE_ELEMENT_ONLY, CONTENT_TYPE_EMPTY, CONTENT_TYPE_MIXED, CONTENT_TYPE_NOT_DETERMINED
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addGuessElement
(CIElement childElement) Add a child element to the list of element's children.int
Returns the string representation for all assertions.Returns the list with the element attributes.Returns the list with the element attributes which have default values.int
Get the content type of the element.Get the value of theFRACTION_DIGITS
facet, can benull
if it is not defined.Get the value of theLENGTH
facet, can benull
if it is not defined.Get the value of theMAX_EXCLUSIVE
facet, can benull
if it is not defined.Get the value of theMAX_INCLUSIVE
facet, can benull
if it is not defined.Get the value of theMAX LENGTH
facet, can benull
if it is not defined.Get the value of theMIN_EXCLUSIVE
facet, can benull
if it is not defined.Get the value of theMIN_INCLUSIVE
facet, can benull
if it is not defined.Get the value of theMIN LENGTH
facet, can benull
if it is not defined.Get the value of theTOTAL_DIGITS
facet, can benull
if it is not defined.Get the value of theWHITESPACE
facet, can benull
if it is not defined.Get the list with the children elements of the current element.Get the model description.getName()
Get the node(attribute or element) name.Returns the mode of the open content.Returns the description for the open content wildcard.Get the possible values as a list ofString
values.getQName()
Returns the qualified name of the element.Gets the type description for the element.boolean
true
if the element has a fixed value.boolean
boolean
boolean
isEmpty()
true
if the element is empty because it has empty content type or the element type isnillable
.boolean
void
setAnnotation
(String annotation) Sets the annotation for the element.void
setAssertions
(String assertions) Sets the string representation for the node type assertions.void
setAttributes
(List<CIAttribute> attributes) Sets the list with the element attributes.void
setContentType
(int contentType) Sets the content type of the element.void
setDeclareXmlns
(boolean declareXmlns) Sets the value of the flag indicating if thexmlns
declaration must be added for the element.void
setFacetFractionDigitsValue
(String fractionDigitsFacetValue) Set the value of theFRACTION_DIGITS
facet.void
setFacetLengthValue
(String lengthFacetValue) Set the value of theLENGTH
facet.void
setFacetMaxExclusiveValue
(String maxExclusiveFacetValue) Set the value of theMAX_EXCLUSIVE
facet.void
setFacetMaxInclusiveValue
(String maxInclusiveFacetValue) Set the value of theMAX_INCLUSIVE
facet.void
setFacetMaxLengthValue
(String maxLengthFacetValue) Set the value of theMAX_LENGTH
facet.void
setFacetMinExclusiveValue
(String minExclusiveFacetValue) Set the value of theMIN_EXCLUSIVE
facet.void
setFacetMinInclusiveValue
(String minInclusiveFacetValue) Set the value of theMIN_INCLUSIVE
facet.void
setFacetMinLengthValue
(String minLengthFacetValue) Set the value of theMIN_LENGTH
facet.void
setFacetPattern
(String patternFacets) Set the value of thePATTERN
facets.void
setFacetTotalDigitsValue
(String totalDigitsFacetValue) Set the value of theTOTAL_DIGITS
facet.void
setFacetWhitespaceValue
(String whitespaceFacetValue) Set the value of theWHITESPACE
facet.void
setHasFixedValueType
(boolean hasFixedValue) Set if the element has a fixed value.void
setModelDescription
(String modelDescription) Set the model description for the node.void
Set the name of the element.void
setNamespace
(String namespace) Set the namespace URI for the element.void
setNillable
(boolean nillable) Sets the flag representing the value of thenillable
attribute of element.void
setOpenContentMode
(String mode) Sets the mode of the open content.void
setOpenContentWildcardDescription
(String wildcardDescription) Sets the description for the open content wildcard.void
setPossiblesValues
(List<String> possiblesValues) Set the list of possible values for the node.void
Set the prefix associated with the element namespace.void
setTypeDescription
(String typeDescription) Sets the type description for the current element
-
Constructor Details
-
CIElementAdapter
public CIElementAdapter()
-
-
Method Details
-
addGuessElement
Description copied from interface:CIElement
Add a child element to the list of element's children. When the currentCIElement
is chosen from the list of proposed elements (e.g. the list of proposals from the Content Completion window), the children elements are also inserted.
For example ifperson
is the currentCIElement
, and the list of children contains the elementsname
andaddress
, the result of choosing the person entry from the Content Completion window will be the insertion of the following sequence:<person> <name>...</name> <address>...</address> </person>
SchemaManagerFilter.filterElements(List, WhatElementsCanGoHereContext)
method to add new children to theCIElements
proposed by the originalSchemaManager
.- Specified by:
addGuessElement
in interfaceCIElement
- Parameters:
childElement
- TheCIElement
element to be added as child.- See Also:
-
getAttributes
Description copied from interface:CIElement
Returns the list with the element attributes.- Specified by:
getAttributes
in interfaceCIElement
- Returns:
- The list with
CIAttribute
ornull
if the element has no attributes. - See Also:
-
getAttributesWithDefaultValues
Description copied from interface:CIElement
Returns the list with the element attributes which have default values.- Specified by:
getAttributesWithDefaultValues
in interfaceCIElement
- Returns:
- The list with
CIAttribute
which have default values ornull
if the element has no attributes. - See Also:
-
getContentType
public int getContentType()Description copied from interface:CIElement
Get the content type of the element.- Specified by:
getContentType
in interfaceCIElement
- Returns:
- The content type of the element.
Can be one of the constants:
CIElement.CONTENT_TYPE_ELEMENT_ONLY
,CIElement.CONTENT_TYPE_EMPTY
,CIElement.CONTENT_TYPE_MIXED
,CIElement.CONTENT_TYPE_NOT_DETERMINED
. - See Also:
-
getGuessElements
Description copied from interface:CIElement
Get the list with the children elements of the current element. When the currentCIElement
is chosen from the list of proposed elements (e.g. the list of proposals from the Content Completion window), the children elements are also inserted in the document.
For example ifperson
is the currentCIElement
, and the list of children contains the elementsname
andaddress
, the result of choosing the person entry from the Content Completion window will be the insertion of the following sequence:
<person> <name>...</name> <address>...</address> </person>
SchemaManagerFilter.filterElements(List, WhatElementsCanGoHereContext)
method in order to return a customized list of children, thus modifying the original list proposed by theSchemaManager
.- Specified by:
getGuessElements
in interfaceCIElement
- Returns:
- A list of
CIElement
objects, ornull
if the element accepts no children. - See Also:
-
getNamespace
- Specified by:
getNamespace
in interfaceCIElement
- Returns:
- The namespace URI of the element string or
null
if the element has no namespace. - See Also:
-
getPrefix
-
getQName
Description copied from interface:CIElement
Returns the qualified name of the element. It is obtained from the namespace prefix and the local name. -
getTypeDescription
Description copied from interface:CIElement
Gets the type description for the element.- Specified by:
getTypeDescription
in interfaceCIElement
- Returns:
- A
String
description of the element type. - See Also:
-
hasPrefix
public boolean hasPrefix() -
isDeclareXmlns
public boolean isDeclareXmlns()- Specified by:
isDeclareXmlns
in interfaceCIElement
- Returns:
true
if the element has anxmlns
declaration.- See Also:
-
isEmpty
public boolean isEmpty()Description copied from interface:CIElement
true
if the element is empty because it has empty content type or the element type isnillable
. -
isNillable
public boolean isNillable()- Specified by:
isNillable
in interfaceCIElement
- Returns:
true
if the content of the element isnillable
. Used only for XML Schema elements.- See Also:
-
setAnnotation
Description copied from interface:CIElement
Sets the annotation for the element.- Specified by:
setAnnotation
in interfaceCIElement
- Parameters:
annotation
- A text annotation for the element, ornull
.- See Also:
-
setAttributes
Description copied from interface:CIElement
Sets the list with the element attributes.- Specified by:
setAttributes
in interfaceCIElement
- Parameters:
attributes
- The list ofCIAttribute
to be set.- See Also:
-
setContentType
public void setContentType(int contentType) Description copied from interface:CIElement
Sets the content type of the element.- Specified by:
setContentType
in interfaceCIElement
- Parameters:
contentType
- The content type of the element. It can be one of the constants:CIElement.CONTENT_TYPE_ELEMENT_ONLY
,CIElement.CONTENT_TYPE_EMPTY
,CIElement.CONTENT_TYPE_MIXED
,CIElement.CONTENT_TYPE_NOT_DETERMINED
.- See Also:
-
setDeclareXmlns
public void setDeclareXmlns(boolean declareXmlns) Description copied from interface:CIElement
Sets the value of the flag indicating if thexmlns
declaration must be added for the element.- Specified by:
setDeclareXmlns
in interfaceCIElement
- Parameters:
declareXmlns
-true
if the namespace must be declared.- See Also:
-
setName
Description copied from interface:CIElement
Set the name of the element. -
setNamespace
Description copied from interface:CIElement
Set the namespace URI for the element.- Specified by:
setNamespace
in interfaceCIElement
- Parameters:
namespace
- The namespace URI to be set.- See Also:
-
setNillable
public void setNillable(boolean nillable) Description copied from interface:CIElement
Sets the flag representing the value of thenillable
attribute of element. Used only for elements defined in an XML Schema.- Specified by:
setNillable
in interfaceCIElement
- Parameters:
nillable
-true
if the content of the element defined in the XML Schema isnillable
.- See Also:
-
setPrefix
Description copied from interface:CIElement
Set the prefix associated with the element namespace. -
setTypeDescription
Description copied from interface:CIElement
Sets the type description for the current element- Specified by:
setTypeDescription
in interfaceCIElement
- Parameters:
typeDescription
- The String representing the type description.- See Also:
-
compareTo
- Specified by:
compareTo
in interfaceComparable<CIElement>
- See Also:
-
getAnnotation
- Specified by:
getAnnotation
in interfaceNodeDescription
- Returns:
- The node annotation, can be
null
. - See Also:
-
getFacetFractionDigitsValue
Description copied from interface:NodeDescription
Get the value of theFRACTION_DIGITS
facet, can benull
if it is not defined.- Specified by:
getFacetFractionDigitsValue
in interfaceNodeDescription
- Returns:
- The value of the
FRACTION_DIGITS
facet. - See Also:
-
getFacetLengthValue
Description copied from interface:NodeDescription
Get the value of theLENGTH
facet, can benull
if it is not defined.- Specified by:
getFacetLengthValue
in interfaceNodeDescription
- Returns:
- The value of the
LENGTH
facet. - See Also:
-
getFacetMaxExclusiveValue
Description copied from interface:NodeDescription
Get the value of theMAX_EXCLUSIVE
facet, can benull
if it is not defined.- Specified by:
getFacetMaxExclusiveValue
in interfaceNodeDescription
- Returns:
- The value of the
MAX_EXCLUSIVE
facet. - See Also:
-
getFacetMaxInclusiveValue
Description copied from interface:NodeDescription
Get the value of theMAX_INCLUSIVE
facet, can benull
if it is not defined.- Specified by:
getFacetMaxInclusiveValue
in interfaceNodeDescription
- Returns:
- The value of the
MAX_INCLUSIVE
facet. - See Also:
-
getFacetMaxLengthValue
Description copied from interface:NodeDescription
Get the value of theMAX LENGTH
facet, can benull
if it is not defined.- Specified by:
getFacetMaxLengthValue
in interfaceNodeDescription
- Returns:
- The value of the
MAX LENGTH
facet. - See Also:
-
getFacetMinExclusiveValue
Description copied from interface:NodeDescription
Get the value of theMIN_EXCLUSIVE
facet, can benull
if it is not defined.- Specified by:
getFacetMinExclusiveValue
in interfaceNodeDescription
- Returns:
- The value of the
MIN_EXCLUSIVE
facet. - See Also:
-
getFacetMinInclusiveValue
Description copied from interface:NodeDescription
Get the value of theMIN_INCLUSIVE
facet, can benull
if it is not defined.- Specified by:
getFacetMinInclusiveValue
in interfaceNodeDescription
- Returns:
- The value of the
MIN_INCLUSIVE
facet. - See Also:
-
getFacetMinLengthValue
Description copied from interface:NodeDescription
Get the value of theMIN LENGTH
facet, can benull
if it is not defined.- Specified by:
getFacetMinLengthValue
in interfaceNodeDescription
- Returns:
- The value of the
MIN LENGTH
facet. - See Also:
-
getFacetPattern
Description copied from interface:NodeDescription
- Specified by:
getFacetPattern
in interfaceNodeDescription
- Returns:
- The
PATTERN
facets as aString
. - See Also:
-
getFacetTotalDigitsValue
Description copied from interface:NodeDescription
Get the value of theTOTAL_DIGITS
facet, can benull
if it is not defined.- Specified by:
getFacetTotalDigitsValue
in interfaceNodeDescription
- Returns:
- The value of the
TOTAL_DIGITS
facet. - See Also:
-
getFacetWhitespaceValue
Description copied from interface:NodeDescription
Get the value of theWHITESPACE
facet, can benull
if it is not defined.- Specified by:
getFacetWhitespaceValue
in interfaceNodeDescription
- Returns:
- The value of the
WHITESPACE
facet. - See Also:
-
getModelDescription
Description copied from interface:NodeDescription
Get the model description.- Specified by:
getModelDescription
in interfaceNodeDescription
- Returns:
- The model description.
- See Also:
-
getName
Description copied from interface:NodeDescription
Get the node(attribute or element) name.- Specified by:
getName
in interfaceNodeDescription
- Returns:
- The node(attribute or element) name.
- See Also:
-
getPossibleValues
Description copied from interface:NodeDescription
Get the possible values as a list ofString
values.- Specified by:
getPossibleValues
in interfaceNodeDescription
- Returns:
- The list of possible values.
- See Also:
-
setFacetFractionDigitsValue
Description copied from interface:NodeDescription
Set the value of theFRACTION_DIGITS
facet.- Specified by:
setFacetFractionDigitsValue
in interfaceNodeDescription
- Parameters:
fractionDigitsFacetValue
- The value of theFRACTION_DIGITS
facet to set.- See Also:
-
setFacetLengthValue
Description copied from interface:NodeDescription
Set the value of theLENGTH
facet.- Specified by:
setFacetLengthValue
in interfaceNodeDescription
- Parameters:
lengthFacetValue
- The value of theLENGTH
facet to set.- See Also:
-
setFacetMaxExclusiveValue
Description copied from interface:NodeDescription
Set the value of theMAX_EXCLUSIVE
facet.- Specified by:
setFacetMaxExclusiveValue
in interfaceNodeDescription
- Parameters:
maxExclusiveFacetValue
- The value of theMAX_EXCLUSIVE
facet to set.- See Also:
-
setFacetMaxInclusiveValue
Description copied from interface:NodeDescription
Set the value of theMAX_INCLUSIVE
facet.- Specified by:
setFacetMaxInclusiveValue
in interfaceNodeDescription
- Parameters:
maxInclusiveFacetValue
- The value of theMAX_INCLUSIVE
facet to set.- See Also:
-
setFacetMaxLengthValue
Description copied from interface:NodeDescription
Set the value of theMAX_LENGTH
facet.- Specified by:
setFacetMaxLengthValue
in interfaceNodeDescription
- Parameters:
maxLengthFacetValue
- The value of theMAX_LENGTH
facet to set.- See Also:
-
setFacetMinExclusiveValue
Description copied from interface:NodeDescription
Set the value of theMIN_EXCLUSIVE
facet.- Specified by:
setFacetMinExclusiveValue
in interfaceNodeDescription
- Parameters:
minExclusiveFacetValue
- The value of theMIN_EXCLUSIVE
facet to set.- See Also:
-
setFacetMinInclusiveValue
Description copied from interface:NodeDescription
Set the value of theMIN_INCLUSIVE
facet.- Specified by:
setFacetMinInclusiveValue
in interfaceNodeDescription
- Parameters:
minInclusiveFacetValue
- The value of theMIN_INCLUSIVE
facet to set.- See Also:
-
setFacetMinLengthValue
Description copied from interface:NodeDescription
Set the value of theMIN_LENGTH
facet.- Specified by:
setFacetMinLengthValue
in interfaceNodeDescription
- Parameters:
minLengthFacetValue
- The value of theMIN_LENGTH
facet to set.- See Also:
-
setFacetPattern
Description copied from interface:NodeDescription
Set the value of thePATTERN
facets.- Specified by:
setFacetPattern
in interfaceNodeDescription
- Parameters:
patternFacets
- The value of thePATTERN
facets to set.- See Also:
-
setFacetTotalDigitsValue
Description copied from interface:NodeDescription
Set the value of theTOTAL_DIGITS
facet.- Specified by:
setFacetTotalDigitsValue
in interfaceNodeDescription
- Parameters:
totalDigitsFacetValue
- The value of theTOTAL_DIGITS
facet to set.- See Also:
-
setFacetWhitespaceValue
Description copied from interface:NodeDescription
Set the value of theWHITESPACE
facet.- Specified by:
setFacetWhitespaceValue
in interfaceNodeDescription
- Parameters:
whitespaceFacetValue
- The value of theWHITESPACE
facet to set.- See Also:
-
setModelDescription
Description copied from interface:NodeDescription
Set the model description for the node.- Specified by:
setModelDescription
in interfaceNodeDescription
- Parameters:
modelDescription
- The modelDescription to set.- See Also:
-
setPossiblesValues
Description copied from interface:NodeDescription
Set the list of possible values for the node.- Specified by:
setPossiblesValues
in interfaceNodeDescription
- Parameters:
possiblesValues
- The list with possible (String
) values.- See Also:
-
setAssertions
Description copied from interface:NodeDescription
Sets the string representation for the node type assertions.- Specified by:
setAssertions
in interfaceNodeDescription
- Parameters:
assertions
- The string representing all assertions.- See Also:
-
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:
-
setOpenContentMode
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:
-
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:
-
setOpenContentWildcardDescription
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:
-
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:
-
hasFixedValue
public boolean hasFixedValue()Description copied from interface:CIElement
true
if the element has a fixed value.- Specified by:
hasFixedValue
in interfaceCIElement
- Returns:
- true if the element has a fixed value.
- See Also:
-
setHasFixedValueType
public void setHasFixedValueType(boolean hasFixedValue) Description copied from interface:CIElement
Set if the element has a fixed value.- Specified by:
setHasFixedValueType
in interfaceCIElement
- Parameters:
hasFixedValue
-true
if the element has a fixed value.- See Also:
-