ca.quine.jcommons.marshaller
Class Marshaller

java.lang.Object
  |
  +--ca.quine.jcommons.marshaller.Marshaller

public class Marshaller
extends Object


Field Summary
static int FQCN_ALWAYS
          Always use a fully qualified class name.
static int FQCN_FOR_NON_JDK_ONLY
          Display a fully qualified class name only for non-JDK classes.
static int FQCN_NEVER
          Never use a fully qualified class name; always use only the class name.
static int SHOW_ACTUAL_TYPE
          Show the actual type being held by a field (if the object is not null), not the type declared by the field.
static int SHOW_DECLARED_TYPE
          Show the declared type of the field for all fields in the generated mindmap.
 
Constructor Summary
Marshaller(int fqcn, int showType)
          Creates a new Marshaller.
Marshaller(int fqcn, int showType, MarshallerFactory marshallerFactory)
          Creates a new Marshaller with the given MarshallerFactory.
 
Method Summary
 String fqcn(Class clazz)
          Returns a fully qualified class name or just a class name depending on the private attribute fqcn(java.lang.Class).
static String htmlEntityEncode(String s)
          Encodes the given String with HTML entity encoding.
 void marshal(Node rootNode, Object object)
           
 Map marshal(Object object)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FQCN_NEVER

public static int FQCN_NEVER
Never use a fully qualified class name; always use only the class name.


FQCN_FOR_NON_JDK_ONLY

public static int FQCN_FOR_NON_JDK_ONLY
Display a fully qualified class name only for non-JDK classes.


FQCN_ALWAYS

public static int FQCN_ALWAYS
Always use a fully qualified class name.


SHOW_DECLARED_TYPE

public static int SHOW_DECLARED_TYPE
Show the declared type of the field for all fields in the generated mindmap.


SHOW_ACTUAL_TYPE

public static int SHOW_ACTUAL_TYPE
Show the actual type being held by a field (if the object is not null), not the type declared by the field.

Constructor Detail

Marshaller

public Marshaller(int fqcn,
                  int showType)
Creates a new Marshaller.

Parameters:
fqcn - valid values are FQCN_ALWAYS, FQCN_FOR_NON_JDK_ONLY and FQCN_NEVER
showType - valid values are SHOW_DECLARED_TYPE and SHOW_ACTUAL_TYPE

Marshaller

public Marshaller(int fqcn,
                  int showType,
                  MarshallerFactory marshallerFactory)
Creates a new Marshaller with the given MarshallerFactory. This constructor offers the possibility of subclassing MarshallerFactory and providing additional IMarshallers or overriding existing ones in a different JAR.

Parameters:
fqcn - valid values are FQCN_ALWAYS, FQCN_FOR_NON_JDK_ONLY and FQCN_NEVER
showType - valid values are SHOW_DECLARED_TYPE and SHOW_ACTUAL_TYPE
marshallerFactory - by subclassing MarshallerFactory and providing that implementation here, it is possible to extend the existing marshalling behaviour
Method Detail

marshal

public Map marshal(Object object)
            throws NoSuchFieldException,
                   IllegalAccessException,
                   ClassNotFoundException
NoSuchFieldException
IllegalAccessException
ClassNotFoundException

marshal

public void marshal(Node rootNode,
                    Object object)
             throws NoSuchFieldException,
                    IllegalAccessException,
                    ClassNotFoundException
NoSuchFieldException
IllegalAccessException
ClassNotFoundException

fqcn

public String fqcn(Class clazz)
Returns a fully qualified class name or just a class name depending on the private attribute fqcn(java.lang.Class).

Returns:
a fully qualified class name or just a class name depending on the private attribute fqcn(java.lang.Class)

htmlEntityEncode

public static String htmlEntityEncode(String s)
Encodes the given String with HTML entity encoding. Taken and modified from: http://www.owasp.org/index.php/How_to_perform_HTML_entity_encoding_in_Java on Dec 1, 2007.

Parameters:
s - the String to entity encode
Returns:
an HTML entity encoded String