common-util

local.tomas.common.xml.impl
Class TokenGeneratorImpl

java.lang.Object
  extended by local.tomas.common.xml.impl.TokenGeneratorImpl
All Implemented Interfaces:
XMLTokenGenerator

public class TokenGeneratorImpl
extends Object
implements XMLTokenGenerator

Token generator implementation.

Author:
tomas

Field Summary
protected  ContentHandler handler
           
protected  XMLIdGenerator idGenerator
           
protected  String nsu
           
 
Constructor Summary
TokenGeneratorImpl(String nsu, ContentHandler handler, XMLIdGenerator idGenerator)
          Construct token generator.
 
Method Summary
 void charToken(String str)
          Create character token.
 boolean createRefToken(String name, int index, Class type, Object src)
          Try to create reference to another token.
 void endToken(String name)
          Create end token.
 ContentHandler getHandler()
          Get content handler.
 void setHandler(ContentHandler handler)
          Set content handler.
 void startToken(String name, int index, String className, int size, Object obj)
          Create start token.
 void startToken(String name, int index, String className, Object obj)
          Create start token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nsu

protected String nsu

handler

protected ContentHandler handler

idGenerator

protected XMLIdGenerator idGenerator
Constructor Detail

TokenGeneratorImpl

public TokenGeneratorImpl(String nsu,
                          ContentHandler handler,
                          XMLIdGenerator idGenerator)
Construct token generator.

Parameters:
nsu - namespace URI
handler - content handler
idGenerator - ID generator
Method Detail

getHandler

public ContentHandler getHandler()
Get content handler.

Returns:
Returns the handler.

setHandler

public void setHandler(ContentHandler handler)
Set content handler.

Parameters:
handler - The handler to set.

startToken

public void startToken(String name,
                       int index,
                       String className,
                       int size,
                       Object obj)
                throws XMLException
Description copied from interface: XMLTokenGenerator
Create start token.

Specified by:
startToken in interface XMLTokenGenerator
Parameters:
name - - token name
index - - index attribute value, negative values are omitted
className - - class name of object
size - - object size
obj - - object described by this token
Throws:
XMLException

startToken

public void startToken(String name,
                       int index,
                       String className,
                       Object obj)
                throws XMLException
Description copied from interface: XMLTokenGenerator
Create start token.

Specified by:
startToken in interface XMLTokenGenerator
Parameters:
name - - token name
index - - index attribute value, negative values are omitted
className - - class name of object
obj - - object described by this token
Throws:
XMLException

endToken

public void endToken(String name)
              throws XMLException
Description copied from interface: XMLTokenGenerator
Create end token.

Specified by:
endToken in interface XMLTokenGenerator
Parameters:
name - - token name
Throws:
XMLException

charToken

public void charToken(String str)
               throws XMLException
Description copied from interface: XMLTokenGenerator
Create character token.

Specified by:
charToken in interface XMLTokenGenerator
Parameters:
str - - characters
Throws:
XMLException

createRefToken

public boolean createRefToken(String name,
                              int index,
                              Class type,
                              Object src)
                       throws XMLException
Description copied from interface: XMLTokenGenerator
Try to create reference to another token.

Specified by:
createRefToken in interface XMLTokenGenerator
Parameters:
name - - token name
index - - index attribute value, negative values are omitted
type - - type of object described
src - - the object described by this token
Returns:
true if a reference could be created
Throws:
XMLException

common-util

Copyright © 2007 null. All Rights Reserved.