Package net.sf.okapi.lib.xliff2.core
Class ExtElement
- java.lang.Object
-
- net.sf.okapi.lib.xliff2.core.DataWithExtAttributes
-
- net.sf.okapi.lib.xliff2.core.ExtElement
-
- All Implemented Interfaces:
IExtChild,IWithExtAttributes
public class ExtElement extends DataWithExtAttributes implements IExtChild
Represent an extension (or un-supported module) element.
-
-
Constructor Summary
Constructors Constructor Description ExtElement(QName qName)Creates a newExtElementobject.ExtElement(ExtElement original)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IExtChildaddChild(IExtChild child)Adds aIExtChildobject to this element.ExtContentaddContent(String text)Adds a text content to this element.ExtElementaddElement(String localPart)Adds a child element to this element, both of the same namespace.ExtElementaddElement(String namespaceURI, String localPart, String prefix)Adds a child element to this element.booleanequals(Object obj)Indicates if this object is equals to a given one.List<IExtChild>getChildren()Gets the list of the children of this element.ExtContentgetFirstContent()Gets the first child content of this element.ExtElementgetFirstElement()Gets the first child element of this element.ExtElementgetFirstElement(String namespaceURI, String localName)Gets the first element child for a given namespace and name of this element.QNamegetQName()Gets the QName of this element.ExtChildTypegetType()Gets theExtChildTypetype for this element.booleanhasChild()Indicates if this element has at least one child.inthashCode()booleanisModule()Indicates if this extension element is part of a module or not.-
Methods inherited from class net.sf.okapi.lib.xliff2.core.DataWithExtAttributes
getExtAttributes, getExtAttributeValue, hasExtAttribute, setExtAttributes
-
-
-
-
Constructor Detail
-
ExtElement
public ExtElement(ExtElement original)
Copy constructor.- Parameters:
original- the original object to duplicate.
-
ExtElement
public ExtElement(QName qName)
Creates a newExtElementobject.- Parameters:
qName- the qualified name of the element.
-
-
Method Detail
-
getQName
public QName getQName()
Gets the QName of this element.- Returns:
- the QName of this element.
-
getType
public ExtChildType getType()
Gets theExtChildTypetype for this element.- Specified by:
getTypein interfaceIExtChild- Returns:
- the
ExtChildTypetype for this element.
-
hasChild
public boolean hasChild()
Indicates if this element has at least one child.- Returns:
- true if this element has at least one child, false otherwise.
-
getChildren
public List<IExtChild> getChildren()
Gets the list of the children of this element. An empty list is created if needed.- Returns:
- list of the children of this element.
- See Also:
hasChild()
-
getFirstElement
public ExtElement getFirstElement(String namespaceURI, String localName)
Gets the first element child for a given namespace and name of this element.- Parameters:
namespaceURI- the namespace URI of the element to retrieve.localName- the name of the element to retrieve.- Returns:
- the first child element of the given namespace and name if it exists, or null if it does not.
-
getFirstElement
public ExtElement getFirstElement()
Gets the first child element of this element.- Returns:
- the first child element of this element, or null if there is no child element.
-
getFirstContent
public ExtContent getFirstContent()
Gets the first child content of this element.- Returns:
- the first child content of this element, or null if there is no child content.
-
addChild
public IExtChild addChild(IExtChild child)
Adds aIExtChildobject to this element.- Parameters:
child- the object to add.- Returns:
- the added object.
-
addElement
public ExtElement addElement(String namespaceURI, String localPart, String prefix)
Adds a child element to this element.- Parameters:
namespaceURI- the namespace URI of the element to add.localPart- the local part of the name of the element to add.prefix- the prefix of the name of the element to add.- Returns:
- the added element.
-
addElement
public ExtElement addElement(String localPart)
Adds a child element to this element, both of the same namespace.- Parameters:
localPart- the local part of the name of the element to add.- Returns:
- the added element.
-
addContent
public ExtContent addContent(String text)
Adds a text content to this element.- Parameters:
text- the text to add.- Returns:
- the added
ExtContentobject.
-
isModule
public boolean isModule()
Indicates if this extension element is part of a module or not.- Returns:
- true if this extension element is part of a module.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classDataWithExtAttributes
-
equals
public boolean equals(Object obj)
Description copied from class:DataWithExtAttributesIndicates if this object is equals to a given one.- Overrides:
equalsin classDataWithExtAttributes- Parameters:
obj- the other object to compare.- Returns:
- true if the two objects are identical.
-
-