Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.java.beans.decoder
Class CharHandler  view CharHandler download CharHandler.java

java.lang.Object
  extended bygnu.java.beans.decoder.AbstractElementHandler
      extended bygnu.java.beans.decoder.SimpleHandler
          extended bygnu.java.beans.decoder.CharHandler
All Implemented Interfaces:
ElementHandler

class CharHandler
extends SimpleHandler

Creates a Character instance from the character data in a <char> tag.


Constructor Summary
(package private) CharHandler(ElementHandler parent)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          Adds characters from the body of the XML tag to the buffer.
 void end(java.beans.ExceptionListener exceptionListener)
          Post-processes the Context.
 void endElement(java.lang.String characters)
          Processes the character data when the element ends.
 Context getContext()
          Returns the Context instance this handler is working on.
 java.lang.Object getObject(java.lang.String objectId)
          Returns a previously stored object.
 ElementHandler getParent()
           
 boolean hasFailed()
          Returns whether this handler has failed.
 java.lang.Class instantiateClass(java.lang.String className)
          Returns the Class instance as if called Class.forName() but uses a ClassLoader given by the user.
 boolean isSubelementAllowed(java.lang.String subElementName)
          Returns whether a subelement of the given name is allowed.
 void notifyContextFailed()
          Marks this and any depending parent handlers as failed.
 void notifyStatement(java.beans.ExceptionListener exceptionListener)
          Notifies the handler's Context that its child Context will not return a value back.
protected  java.lang.Object parse(java.lang.String number)
          Returns an object that is created from the given characters.
 void putObject(java.lang.String objectId, java.lang.Object o)
          Stores an object globally under a unique id.
 void start(org.xml.sax.Attributes attributes, java.beans.ExceptionListener exceptionListener)
          Evaluates the attributes and creates a Context instance.
protected  Context startElement(org.xml.sax.Attributes attributes, java.beans.ExceptionListener exceptionListener)
          Analyses the content of the Attributes instance and creates a Context object accordingly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharHandler

CharHandler(ElementHandler parent)
Method Detail

parse

protected java.lang.Object parse(java.lang.String number)
                          throws AssemblyException
Description copied from class: SimpleHandler
Returns an object that is created from the given characters. If the string is converted into a number a NumberFormatException is cathed and reported appropriately.

Specified by:
parse in class SimpleHandler

startElement

protected final Context startElement(org.xml.sax.Attributes attributes,
                                     java.beans.ExceptionListener exceptionListener)
                              throws AssemblyException
Description copied from class: AbstractElementHandler
Analyses the content of the Attributes instance and creates a Context object accordingly. An AssemblerException is thrown when the Context instance could not be created.

Specified by:
startElement in class AbstractElementHandler

endElement

public void endElement(java.lang.String characters)
                throws AssemblyException,
                       AssemblyException
Description copied from class: AbstractElementHandler
Processes the character data when the element ends. The default implementation does nothing for convenience.

Overrides:
endElement in class AbstractElementHandler

start

public final void start(org.xml.sax.Attributes attributes,
                        java.beans.ExceptionListener exceptionListener)
Evaluates the attributes and creates a Context instance. If the creation of the Context instance fails the ElementHandler is marked as failed which may affect the parent handler other.

Specified by:
start in interface ElementHandler

end

public final void end(java.beans.ExceptionListener exceptionListener)
Post-processes the Context.

Specified by:
end in interface ElementHandler

notifyStatement

public void notifyStatement(java.beans.ExceptionListener exceptionListener)
Notifies the handler's Context that its child Context will not return a value back. Some Context variants need this information to know when a method or a constructor call can be made. This method is called by a child handler.

Specified by:
notifyStatement in interface ElementHandler

notifyContextFailed

public final void notifyContextFailed()
Marks this and any depending parent handlers as failed. Which means that on their end no result is calculated. When a handler has failed no more handlers are accepted within it.

Specified by:
notifyContextFailed in interface ElementHandler

hasFailed

public final boolean hasFailed()
Returns whether this handler has failed. This is used to skip child elements.

Specified by:
hasFailed in interface ElementHandler

characters

public final void characters(char[] ch,
                             int start,
                             int length)
Adds characters from the body of the XML tag to the buffer.

Specified by:
characters in interface ElementHandler

putObject

public void putObject(java.lang.String objectId,
                      java.lang.Object o)
Stores an object globally under a unique id. If the id is null the object is not stored.

Specified by:
putObject in interface ElementHandler

getObject

public java.lang.Object getObject(java.lang.String objectId)
                           throws AssemblyException
Returns a previously stored object. If the id is null the result is null, too.

Specified by:
getObject in interface ElementHandler

instantiateClass

public java.lang.Class instantiateClass(java.lang.String className)
                                 throws java.lang.ClassNotFoundException
Returns the Class instance as if called Class.forName() but uses a ClassLoader given by the user.

Specified by:
instantiateClass in interface ElementHandler

isSubelementAllowed

public final boolean isSubelementAllowed(java.lang.String subElementName)
Description copied from interface: ElementHandler
Returns whether a subelement of the given name is allowed. The rules for evaluating this are derived from the javabeans.dtd which can be found here: Java Persistence Article.

Specified by:
isSubelementAllowed in interface ElementHandler

getContext

public final Context getContext()
Description copied from interface: ElementHandler
Returns the Context instance this handler is working on.

Specified by:
getContext in interface ElementHandler

getParent

public final ElementHandler getParent()
Specified by:
getParent in interface ElementHandler