com.simonstl.moe
Interface CoreComponentI

All Superinterfaces:
AnnotableI, java.lang.Cloneable, NamingI
All Known Subinterfaces:
MutableComponentI
All Known Implementing Classes:
CoreComponent

public interface CoreComponentI
extends NamingI, AnnotableI, java.lang.Cloneable

The CoreComponent interface defines the bare minimum of functionality needed for objects to work with MOE.

version 0.01 is the initial release.

Version:
0.01 24 August 2001
Author:
Simon St.Laurent

Field Summary
static int ATTRIBUTE
           
static int CDATA
           
static int CHARS
           
static int COMMENT
           
static int CONTAINER
           
static int DOCTYPE
           
static int DOCUMENT
           
static int ELEMENT
           
static int END_ATTRIBUTE
           
static int END_CDATA
           
static int END_COMMENT
           
static int END_CONTAINER
           
static int END_DOCTYPE
           
static int END_DOCUMENT
           
static int END_ELEMENT
           
static int END_NAMESPACE
           
static int END_PI
           
static int END_PROPERTY
           
static int GEN_ENTITY_END
           
static int GEN_ENTITY_REF
           
static int GEN_ENTITY_START
           
static int IG_WHITESPACE
           
static int NAMESPACE_DECL
           
static int PI
           
static int PROPERTY
           
static int UNPARSED
           
static int VALUE
           
static int XML_DECL
           
 
Method Summary
 void addContent(CoreComponentI newComponent)
          Adds content to this component.
 void addUnorderedContent(CoreComponentI newComponent)
          Adds an unordered component (usually an attribute) to a component.
 void clearAll()
          Clears the name, namespace information, and content for this component.
 void clearContent()
          Clears the content for this component.
 void clearName()
          Clears the name and namespace information for this component.
 void clearUnorderedContent()
          Clears the unordered content (usually attributes) for this component.
 java.lang.Object clone()
          Returns a clean copy of the component and its contents.
 int getBasicType()
          Returns the basic type of this object, per the constants defined in this interface.
 ComponentListI getContent()
          Returns the content for this component as a list of nodes.
 boolean getIsComplete()
          Returns whether this object is complete (i.e., an element has ended).
 java.lang.String getLocalName()
          Returns the local name for the component
 NamingI getName()
          Returns the name object for the component.
 java.lang.String getNsURI()
          Returns the URI reference value for the namespace.
 CoreComponentI getParent()
          Returns the parent for the component.
 java.lang.String getPrefix()
          Returns the prefix used to represent the namespace URI reference for this component.
 java.lang.String getQName()
          Returns the Qualified Name (QName) for the component.
 java.lang.String getTextContent()
          Returns the content for this component as a string.
 ComponentSetI getUnorderedContent()
          Returns the unordered content for this component.
 int hashCode()
          Returns a key which can be used as a unique identifier for this component.
 boolean listen(CoreComponentI component)
          Accepts new events.
 void print()
          Prints a representation of the component to STDOUT
 void setContent(ComponentListI newContent)
          Sets the content for this component as a list of nodes.
 void setContent(java.lang.String newContent)
          Sets the content for this component as a string.
 void setIsComplete(boolean complete)
          Sets whether this object is complete (i.e., an element has ended).
 void setLocalName(java.lang.String newLocalName)
          Accepts a string which will serve as the local name for this component.
 void setName(NamingI Name)
          Sets the name object for the component.
 void setNsURI(java.lang.String newNsURI)
          Accepts a URI reference value which is used as the namespace for the component.
 void setParent(CoreComponentI _parent)
          Sets the parent object for the component.
 void setPrefix(java.lang.String newPrefix)
          Accepts a string which serves as the prefix for this component.
 void setQName(java.lang.String QName)
          Sets the Qualified Name (QName) for the component.
 void setUnorderedContent(ComponentSetI newContent)
          Sets the unordered content for this component.
 java.lang.String toString()
          Returns a representation of the component as a String.
 java.lang.String toString(ComponentSetI namespaceContext)
          Returns a representation of the component as a String.
 
Methods inherited from interface com.simonstl.moe.AnnotableI
addAll, annotate, getAllAnnotations, getAnnotations, getTypes, hasAnnotation, hasAnnotationOfType, hasAnnotations, removeAllAnnotations, removeAnnotation
 

Field Detail

DOCUMENT

public static final int DOCUMENT

END_DOCUMENT

public static final int END_DOCUMENT

ELEMENT

public static final int ELEMENT

END_ELEMENT

public static final int END_ELEMENT

ATTRIBUTE

public static final int ATTRIBUTE

END_ATTRIBUTE

public static final int END_ATTRIBUTE

COMMENT

public static final int COMMENT

END_COMMENT

public static final int END_COMMENT

PI

public static final int PI

END_PI

public static final int END_PI

DOCTYPE

public static final int DOCTYPE

END_DOCTYPE

public static final int END_DOCTYPE

CDATA

public static final int CDATA

END_CDATA

public static final int END_CDATA

CONTAINER

public static final int CONTAINER

END_CONTAINER

public static final int END_CONTAINER

PROPERTY

public static final int PROPERTY

END_PROPERTY

public static final int END_PROPERTY

XML_DECL

public static final int XML_DECL

NAMESPACE_DECL

public static final int NAMESPACE_DECL

END_NAMESPACE

public static final int END_NAMESPACE

GEN_ENTITY_START

public static final int GEN_ENTITY_START

GEN_ENTITY_END

public static final int GEN_ENTITY_END

GEN_ENTITY_REF

public static final int GEN_ENTITY_REF

IG_WHITESPACE

public static final int IG_WHITESPACE

CHARS

public static final int CHARS

VALUE

public static final int VALUE

UNPARSED

public static final int UNPARSED
Method Detail

hashCode

public int hashCode()
Returns a key which can be used as a unique identifier for this component.
Specified by:
hashCode in interface NamingI
Overrides:
hashCode in class java.lang.Object

setNsURI

public void setNsURI(java.lang.String newNsURI)
Accepts a URI reference value which is used as the namespace for the component.
Specified by:
setNsURI in interface NamingI

getNsURI

public java.lang.String getNsURI()
Returns the URI reference value for the namespace.
Specified by:
getNsURI in interface NamingI

setLocalName

public void setLocalName(java.lang.String newLocalName)
Accepts a string which will serve as the local name for this component.
Specified by:
setLocalName in interface NamingI

getLocalName

public java.lang.String getLocalName()
Returns the local name for the component
Specified by:
getLocalName in interface NamingI

setPrefix

public void setPrefix(java.lang.String newPrefix)
Accepts a string which serves as the prefix for this component.
Specified by:
setPrefix in interface NamingI

getPrefix

public java.lang.String getPrefix()
Returns the prefix used to represent the namespace URI reference for this component.
Specified by:
getPrefix in interface NamingI

getQName

public java.lang.String getQName()
Returns the Qualified Name (QName) for the component.
Specified by:
getQName in interface NamingI

setQName

public void setQName(java.lang.String QName)
Sets the Qualified Name (QName) for the component. Overrides current local name and prefix, if any.
Specified by:
setQName in interface NamingI

getName

public NamingI getName()
Returns the name object for the component.

setName

public void setName(NamingI Name)
Sets the name object for the component.

getParent

public CoreComponentI getParent()
Returns the parent for the component.

setParent

public void setParent(CoreComponentI _parent)
Sets the parent object for the component. Permits upward traversal of document trees.

setContent

public void setContent(java.lang.String newContent)
Sets the content for this component as a string.

setContent

public void setContent(ComponentListI newContent)
Sets the content for this component as a list of nodes.

addContent

public void addContent(CoreComponentI newComponent)
Adds content to this component.

clearContent

public void clearContent()
Clears the content for this component.

getTextContent

public java.lang.String getTextContent()
Returns the content for this component as a string.

getContent

public ComponentListI getContent()
Returns the content for this component as a list of nodes.

addUnorderedContent

public void addUnorderedContent(CoreComponentI newComponent)
Adds an unordered component (usually an attribute) to a component.

clearUnorderedContent

public void clearUnorderedContent()
Clears the unordered content (usually attributes) for this component.

getUnorderedContent

public ComponentSetI getUnorderedContent()
Returns the unordered content for this component.

setUnorderedContent

public void setUnorderedContent(ComponentSetI newContent)
Sets the unordered content for this component.

clearName

public void clearName()
Clears the name and namespace information for this component.

clearAll

public void clearAll()
Clears the name, namespace information, and content for this component.

print

public void print()
Prints a representation of the component to STDOUT

toString

public java.lang.String toString()
Returns a representation of the component as a String. Note: toString() is really only guaranteed effective for debugging, because namespaces may require the additional intelligence of a visitor class.
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(ComponentSetI namespaceContext)
Returns a representation of the component as a String. Given a namespaceContext, this may be more effective than the regular toString().

setIsComplete

public void setIsComplete(boolean complete)
Sets whether this object is complete (i.e., an element has ended).

getIsComplete

public boolean getIsComplete()
Returns whether this object is complete (i.e., an element has ended).

getBasicType

public int getBasicType()
Returns the basic type of this object, per the constants defined in this interface.
public static final int DOCUMENT=0;
public static final int END_DOCUMENT=1;
public static final int ELEMENT=2;
public static final int END_ELEMENT=3;
public static final int ATTRIBUTE=4;
public static final int END_ATTRIBUTE=5;

public static final int CONTAINER=2;
public static final int END_CONTAINER=3;
public static final int PROPERTY=4;
public static final int END_PROPERTY=5;

public static final int COMMENT=6;
public static final int END_COMMENT=7;
public static final int PI=8;
public static final int END_PI=9;
public static final int DOCTYPE=10;
public static final int END_DOCTYPE=11;
public static final int CDATA=12;
public static final int END_CDATA=13;


public static final int XML_DECL=18;
public static final int NAMESPACE_DECL=20;
public static final int END_NAMESPACE=21;

public static final int GENERIC=64;
public static final int END_GENERIC=65;
public static final int GENERIC_CONTENT=66; //for self-contained

public static final int GEN_ENTITY_START=130;
public static final int GEN_ENTITY_END=131;

public static final int GEN_ENTITY_REF=250;
public static final int IG_WHITESPACE=252;
public static final int CHARS=254;

public static final int VALUE=254;

public static final int UNPARSED=258;
While classof tests are useful, there may be many different implementations of each of the types, likely with different object hierarchies. This provides a simple form of self-identification.

listen

public boolean listen(CoreComponentI component)
               throws MOEException
Accepts new events. Returns false until one of those events signals the completion of the current listener. The listen() method is designed for 'conventional' XML use. Attributes will be treated as unordered content, while everything else will be treated as ordered content. If you need to break those expectations, you'll need to use setContent() or setUnorderedContent() directly.

clone

public java.lang.Object clone()
Returns a clean copy of the component and its contents.
Specified by:
clone in interface NamingI
Overrides:
clone in class java.lang.Object