org.castor.xmlctf.util
Class CTFUtils
java.lang.Object
org.castor.xmlctf.util.CTFUtils
public class CTFUtils
extends java.lang.Object
This class contains utility methods needed by the CTF.
$Revision: 6787 $ $Date: 2005-03-05 06:42:06 -0700 (Sat, 05 Mar 2005) $
static int | compare(String document1, String document2) - Compares two XML documents located at 2 given URLs, returning the number
of differences or 0 if both documents are 'XML equivalent'.
|
static Class | getClass(String name, ClassLoader loader) - Returns the class associated with the given name.
|
static Object | instantiateObject(String type, String value, ClassLoader loader) - Converts the given value to a Java representation that corresponds to the
given type.
|
BOOLEAN
public static final String BOOLEAN
The Java primitives.
BYTE
public static final String BYTE
CHARACTER
public static final String CHARACTER
DOUBLE
public static final String DOUBLE
FLOAT
public static final String FLOAT
INT
public static final String INT
LONG
public static final String LONG
SHORT
public static final String SHORT
STRING
public static final String STRING
compare
public static int compare(String document1,
String document2)
throws java.io.IOException
Compares two XML documents located at 2 given URLs, returning the number
of differences or 0 if both documents are 'XML equivalent'.
document1
- the URL of the first XML document.document2
- the URL of the second XML document.
- an int indicating the number of differences or 0 if both
documents are 'XML equivalent'.
getClass
public static Class getClass(String name,
ClassLoader loader)
throws ClassNotFoundException
Returns the class associated with the given name.
name
- the fully qualified name of the class to return. Primitives
are handled through their name and not their class name. For
instance 'boolean' should be used instead of
'java.lang.Boolean.TYPE'.loader
- the ClassLoader to use if the class needs to be loaded
- the class associated with given name.
instantiateObject
public static Object instantiateObject(String type,
String value,
ClassLoader loader)
throws ClassNotFoundException,
MarshalException
Converts the given value to a Java representation that corresponds to the
given type.
type
- a string representation of the java type.value
- the value to be convertedloader
- an optional ClassLoader used in case we need to use the
Unmarshaller to retrieve a complex java object.
- an java object that corresponds to the given value converted to a
java type according to the type passed as parameter.
MarshalException
- if the type is not a recognized primitive type
and no Marshaller can be found for that type
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com