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 TypeMethodDescriptionvoidaddGuessElement(CIElement childElement) Add a child element to the list of element's children.intReturns the string representation for all assertions.Returns the list with the element attributes.Returns the list with the element attributes which have default values.intGet the content type of the element.Get the value of theFRACTION_DIGITSfacet, can benullif it is not defined.Get the value of theLENGTHfacet, can benullif it is not defined.Get the value of theMAX_EXCLUSIVEfacet, can benullif it is not defined.Get the value of theMAX_INCLUSIVEfacet, can benullif it is not defined.Get the value of theMAX LENGTHfacet, can benullif it is not defined.Get the value of theMIN_EXCLUSIVEfacet, can benullif it is not defined.Get the value of theMIN_INCLUSIVEfacet, can benullif it is not defined.Get the value of theMIN LENGTHfacet, can benullif it is not defined.Get the value of theTOTAL_DIGITSfacet, can benullif it is not defined.Get the value of theWHITESPACEfacet, can benullif 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 ofStringvalues.getQName()Returns the qualified name of the element.Gets the type description for the element.booleantrueif the element has a fixed value.booleanbooleanbooleanisEmpty()trueif the element is empty because it has empty content type or the element type isnillable.booleanvoidsetAnnotation(String annotation) Sets the annotation for the element.voidsetAssertions(String assertions) Sets the string representation for the node type assertions.voidsetAttributes(List<CIAttribute> attributes) Sets the list with the element attributes.voidsetContentType(int contentType) Sets the content type of the element.voidsetDeclareXmlns(boolean declareXmlns) Sets the value of the flag indicating if thexmlnsdeclaration must be added for the element.voidsetFacetFractionDigitsValue(String fractionDigitsFacetValue) Set the value of theFRACTION_DIGITSfacet.voidsetFacetLengthValue(String lengthFacetValue) Set the value of theLENGTHfacet.voidsetFacetMaxExclusiveValue(String maxExclusiveFacetValue) Set the value of theMAX_EXCLUSIVEfacet.voidsetFacetMaxInclusiveValue(String maxInclusiveFacetValue) Set the value of theMAX_INCLUSIVEfacet.voidsetFacetMaxLengthValue(String maxLengthFacetValue) Set the value of theMAX_LENGTHfacet.voidsetFacetMinExclusiveValue(String minExclusiveFacetValue) Set the value of theMIN_EXCLUSIVEfacet.voidsetFacetMinInclusiveValue(String minInclusiveFacetValue) Set the value of theMIN_INCLUSIVEfacet.voidsetFacetMinLengthValue(String minLengthFacetValue) Set the value of theMIN_LENGTHfacet.voidsetFacetPattern(String patternFacets) Set the value of thePATTERNfacets.voidsetFacetTotalDigitsValue(String totalDigitsFacetValue) Set the value of theTOTAL_DIGITSfacet.voidsetFacetWhitespaceValue(String whitespaceFacetValue) Set the value of theWHITESPACEfacet.voidsetHasFixedValueType(boolean hasFixedValue) Set if the element has a fixed value.voidsetModelDescription(String modelDescription) Set the model description for the node.voidSet the name of the element.voidsetNamespace(String namespace) Set the namespace URI for the element.voidsetNillable(boolean nillable) Sets the flag representing the value of thenillableattribute of element.voidsetOpenContentMode(String mode) Sets the mode of the open content.voidsetOpenContentWildcardDescription(String wildcardDescription) Sets the description for the open content wildcard.voidsetPossiblesValues(List<String> possiblesValues) Set the list of possible values for the node.voidSet the prefix associated with the element namespace.voidsetTypeDescription(String typeDescription) Sets the type description for the current element
-
Constructor Details
-
CIElementAdapter
public CIElementAdapter()
-
-
Method Details
-
addGuessElement
Description copied from interface:CIElementAdd a child element to the list of element's children. When the currentCIElementis 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 ifpersonis the currentCIElement, and the list of children contains the elementsnameandaddress, the result of choosing the person entry from the Content Completion window will be the insertion of the following sequence:This method can be used in the<person> <name>...</name> <address>...</address> </person>SchemaManagerFilter.filterElements(List, WhatElementsCanGoHereContext)method to add new children to theCIElementsproposed by the originalSchemaManager.- Specified by:
addGuessElementin interfaceCIElement- Parameters:
childElement- TheCIElementelement to be added as child.- See Also:
-
getAttributes
Description copied from interface:CIElementReturns the list with the element attributes.- Specified by:
getAttributesin interfaceCIElement- Returns:
- The list with
CIAttributeornullif the element has no attributes. - See Also:
-
getAttributesWithDefaultValues
Description copied from interface:CIElementReturns the list with the element attributes which have default values.- Specified by:
getAttributesWithDefaultValuesin interfaceCIElement- Returns:
- The list with
CIAttributewhich have default values ornullif the element has no attributes. - See Also:
-
getContentType
public int getContentType()Description copied from interface:CIElementGet the content type of the element.- Specified by:
getContentTypein 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:CIElementGet the list with the children elements of the current element. When the currentCIElementis 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 ifpersonis the currentCIElement, and the list of children contains the elementsnameandaddress, the result of choosing the person entry from the Content Completion window will be the insertion of the following sequence:
This method can be implemented by the CIElements returned by the<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:
getGuessElementsin interfaceCIElement- Returns:
- A list of
CIElementobjects, ornullif the element accepts no children. - See Also:
-
getNamespace
- Specified by:
getNamespacein interfaceCIElement- Returns:
- The namespace URI of the element string or
nullif the element has no namespace. - See Also:
-
getPrefix
-
getQName
Description copied from interface:CIElementReturns the qualified name of the element. It is obtained from the namespace prefix and the local name. -
getTypeDescription
Description copied from interface:CIElementGets the type description for the element.- Specified by:
getTypeDescriptionin interfaceCIElement- Returns:
- A
Stringdescription of the element type. - See Also:
-
hasPrefix
public boolean hasPrefix() -
isDeclareXmlns
public boolean isDeclareXmlns()- Specified by:
isDeclareXmlnsin interfaceCIElement- Returns:
trueif the element has anxmlnsdeclaration.- See Also:
-
isEmpty
public boolean isEmpty()Description copied from interface:CIElementtrueif the element is empty because it has empty content type or the element type isnillable. -
isNillable
public boolean isNillable()- Specified by:
isNillablein interfaceCIElement- Returns:
trueif the content of the element isnillable. Used only for XML Schema elements.- See Also:
-
setAnnotation
Description copied from interface:CIElementSets the annotation for the element.- Specified by:
setAnnotationin interfaceCIElement- Parameters:
annotation- A text annotation for the element, ornull.- See Also:
-
setAttributes
Description copied from interface:CIElementSets the list with the element attributes.- Specified by:
setAttributesin interfaceCIElement- Parameters:
attributes- The list ofCIAttributeto be set.- See Also:
-
setContentType
public void setContentType(int contentType) Description copied from interface:CIElementSets the content type of the element.- Specified by:
setContentTypein 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:CIElementSets the value of the flag indicating if thexmlnsdeclaration must be added for the element.- Specified by:
setDeclareXmlnsin interfaceCIElement- Parameters:
declareXmlns-trueif the namespace must be declared.- See Also:
-
setName
Description copied from interface:CIElementSet the name of the element. -
setNamespace
Description copied from interface:CIElementSet the namespace URI for the element.- Specified by:
setNamespacein interfaceCIElement- Parameters:
namespace- The namespace URI to be set.- See Also:
-
setNillable
public void setNillable(boolean nillable) Description copied from interface:CIElementSets the flag representing the value of thenillableattribute of element. Used only for elements defined in an XML Schema.- Specified by:
setNillablein interfaceCIElement- Parameters:
nillable-trueif the content of the element defined in the XML Schema isnillable.- See Also:
-
setPrefix
Description copied from interface:CIElementSet the prefix associated with the element namespace. -
setTypeDescription
Description copied from interface:CIElementSets the type description for the current element- Specified by:
setTypeDescriptionin interfaceCIElement- Parameters:
typeDescription- The String representing the type description.- See Also:
-
compareTo
- Specified by:
compareToin interfaceComparable<CIElement>- See Also:
-
getAnnotation
- Specified by:
getAnnotationin interfaceNodeDescription- Returns:
- The node annotation, can be
null. - See Also:
-
getFacetFractionDigitsValue
Description copied from interface:NodeDescriptionGet the value of theFRACTION_DIGITSfacet, can benullif it is not defined.- Specified by:
getFacetFractionDigitsValuein interfaceNodeDescription- Returns:
- The value of the
FRACTION_DIGITSfacet. - See Also:
-
getFacetLengthValue
Description copied from interface:NodeDescriptionGet the value of theLENGTHfacet, can benullif it is not defined.- Specified by:
getFacetLengthValuein interfaceNodeDescription- Returns:
- The value of the
LENGTHfacet. - See Also:
-
getFacetMaxExclusiveValue
Description copied from interface:NodeDescriptionGet the value of theMAX_EXCLUSIVEfacet, can benullif it is not defined.- Specified by:
getFacetMaxExclusiveValuein interfaceNodeDescription- Returns:
- The value of the
MAX_EXCLUSIVEfacet. - See Also:
-
getFacetMaxInclusiveValue
Description copied from interface:NodeDescriptionGet the value of theMAX_INCLUSIVEfacet, can benullif it is not defined.- Specified by:
getFacetMaxInclusiveValuein interfaceNodeDescription- Returns:
- The value of the
MAX_INCLUSIVEfacet. - See Also:
-
getFacetMaxLengthValue
Description copied from interface:NodeDescriptionGet the value of theMAX LENGTHfacet, can benullif it is not defined.- Specified by:
getFacetMaxLengthValuein interfaceNodeDescription- Returns:
- The value of the
MAX LENGTHfacet. - See Also:
-
getFacetMinExclusiveValue
Description copied from interface:NodeDescriptionGet the value of theMIN_EXCLUSIVEfacet, can benullif it is not defined.- Specified by:
getFacetMinExclusiveValuein interfaceNodeDescription- Returns:
- The value of the
MIN_EXCLUSIVEfacet. - See Also:
-
getFacetMinInclusiveValue
Description copied from interface:NodeDescriptionGet the value of theMIN_INCLUSIVEfacet, can benullif it is not defined.- Specified by:
getFacetMinInclusiveValuein interfaceNodeDescription- Returns:
- The value of the
MIN_INCLUSIVEfacet. - See Also:
-
getFacetMinLengthValue
Description copied from interface:NodeDescriptionGet the value of theMIN LENGTHfacet, can benullif it is not defined.- Specified by:
getFacetMinLengthValuein interfaceNodeDescription- Returns:
- The value of the
MIN LENGTHfacet. - See Also:
-
getFacetPattern
Description copied from interface:NodeDescription- Specified by:
getFacetPatternin interfaceNodeDescription- Returns:
- The
PATTERNfacets as aString. - See Also:
-
getFacetTotalDigitsValue
Description copied from interface:NodeDescriptionGet the value of theTOTAL_DIGITSfacet, can benullif it is not defined.- Specified by:
getFacetTotalDigitsValuein interfaceNodeDescription- Returns:
- The value of the
TOTAL_DIGITSfacet. - See Also:
-
getFacetWhitespaceValue
Description copied from interface:NodeDescriptionGet the value of theWHITESPACEfacet, can benullif it is not defined.- Specified by:
getFacetWhitespaceValuein interfaceNodeDescription- Returns:
- The value of the
WHITESPACEfacet. - See Also:
-
getModelDescription
Description copied from interface:NodeDescriptionGet the model description.- Specified by:
getModelDescriptionin interfaceNodeDescription- Returns:
- The model description.
- See Also:
-
getName
Description copied from interface:NodeDescriptionGet the node(attribute or element) name.- Specified by:
getNamein interfaceNodeDescription- Returns:
- The node(attribute or element) name.
- See Also:
-
getPossibleValues
Description copied from interface:NodeDescriptionGet the possible values as a list ofStringvalues.- Specified by:
getPossibleValuesin interfaceNodeDescription- Returns:
- The list of possible values.
- See Also:
-
setFacetFractionDigitsValue
Description copied from interface:NodeDescriptionSet the value of theFRACTION_DIGITSfacet.- Specified by:
setFacetFractionDigitsValuein interfaceNodeDescription- Parameters:
fractionDigitsFacetValue- The value of theFRACTION_DIGITSfacet to set.- See Also:
-
setFacetLengthValue
Description copied from interface:NodeDescriptionSet the value of theLENGTHfacet.- Specified by:
setFacetLengthValuein interfaceNodeDescription- Parameters:
lengthFacetValue- The value of theLENGTHfacet to set.- See Also:
-
setFacetMaxExclusiveValue
Description copied from interface:NodeDescriptionSet the value of theMAX_EXCLUSIVEfacet.- Specified by:
setFacetMaxExclusiveValuein interfaceNodeDescription- Parameters:
maxExclusiveFacetValue- The value of theMAX_EXCLUSIVEfacet to set.- See Also:
-
setFacetMaxInclusiveValue
Description copied from interface:NodeDescriptionSet the value of theMAX_INCLUSIVEfacet.- Specified by:
setFacetMaxInclusiveValuein interfaceNodeDescription- Parameters:
maxInclusiveFacetValue- The value of theMAX_INCLUSIVEfacet to set.- See Also:
-
setFacetMaxLengthValue
Description copied from interface:NodeDescriptionSet the value of theMAX_LENGTHfacet.- Specified by:
setFacetMaxLengthValuein interfaceNodeDescription- Parameters:
maxLengthFacetValue- The value of theMAX_LENGTHfacet to set.- See Also:
-
setFacetMinExclusiveValue
Description copied from interface:NodeDescriptionSet the value of theMIN_EXCLUSIVEfacet.- Specified by:
setFacetMinExclusiveValuein interfaceNodeDescription- Parameters:
minExclusiveFacetValue- The value of theMIN_EXCLUSIVEfacet to set.- See Also:
-
setFacetMinInclusiveValue
Description copied from interface:NodeDescriptionSet the value of theMIN_INCLUSIVEfacet.- Specified by:
setFacetMinInclusiveValuein interfaceNodeDescription- Parameters:
minInclusiveFacetValue- The value of theMIN_INCLUSIVEfacet to set.- See Also:
-
setFacetMinLengthValue
Description copied from interface:NodeDescriptionSet the value of theMIN_LENGTHfacet.- Specified by:
setFacetMinLengthValuein interfaceNodeDescription- Parameters:
minLengthFacetValue- The value of theMIN_LENGTHfacet to set.- See Also:
-
setFacetPattern
Description copied from interface:NodeDescriptionSet the value of thePATTERNfacets.- Specified by:
setFacetPatternin interfaceNodeDescription- Parameters:
patternFacets- The value of thePATTERNfacets to set.- See Also:
-
setFacetTotalDigitsValue
Description copied from interface:NodeDescriptionSet the value of theTOTAL_DIGITSfacet.- Specified by:
setFacetTotalDigitsValuein interfaceNodeDescription- Parameters:
totalDigitsFacetValue- The value of theTOTAL_DIGITSfacet to set.- See Also:
-
setFacetWhitespaceValue
Description copied from interface:NodeDescriptionSet the value of theWHITESPACEfacet.- Specified by:
setFacetWhitespaceValuein interfaceNodeDescription- Parameters:
whitespaceFacetValue- The value of theWHITESPACEfacet to set.- See Also:
-
setModelDescription
Description copied from interface:NodeDescriptionSet the model description for the node.- Specified by:
setModelDescriptionin interfaceNodeDescription- Parameters:
modelDescription- The modelDescription to set.- See Also:
-
setPossiblesValues
Description copied from interface:NodeDescriptionSet the list of possible values for the node.- Specified by:
setPossiblesValuesin interfaceNodeDescription- Parameters:
possiblesValues- The list with possible (String) values.- See Also:
-
setAssertions
Description copied from interface:NodeDescriptionSets the string representation for the node type assertions.- Specified by:
setAssertionsin interfaceNodeDescription- Parameters:
assertions- 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:
-
hasFixedValue
public boolean hasFixedValue()Description copied from interface:CIElementtrueif the element has a fixed value.- Specified by:
hasFixedValuein interfaceCIElement- Returns:
- true if the element has a fixed value.
- See Also:
-
setHasFixedValueType
public void setHasFixedValueType(boolean hasFixedValue) Description copied from interface:CIElementSet if the element has a fixed value.- Specified by:
setHasFixedValueTypein interfaceCIElement- Parameters:
hasFixedValue-trueif the element has a fixed value.- See Also:
-