|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcookxml.core.CookXml
This class is a general purpose XML configurator.
| Constructor Summary | |
CookXml(DocumentBuilder builder,
TagLibrary tagLibrary,
Object varObj)
constructor. |
|
CookXml(DocumentBuilder builder,
TagLibrary tagLibrary,
VarLookup varLookup)
constructor. |
|
| Method Summary | |
static boolean |
debug(Exception ex)
This function is supposed to work in conjunction with assert to generate a debug message but does not really throw an Exception |
static boolean |
debug(String msg)
This function is supposed to work in conjunction with assert to generate a debug message but does not really throw an Exception |
static boolean |
debug(String msg,
Exception ex)
This function is supposed to work in conjunction with assert to generate a debug message but does not really throw an Exception |
ClassLoader |
getClassLoader()
Obtain the ClassLoader that is used to locate resources. |
static ClassLoader |
getDefaultClassLoader()
Obtain the default ClassLoader that is used to locate resources. |
static ExceptionHandler |
getDefaultExceptionHandler()
Obtain the default ExceptionHandler for all instances of CookXml. |
DocumentBuilder |
getDocumentBuilder()
Gets the DocumentBuilder used by this CookXml object. |
ExceptionHandler |
getExceptionHandler()
returns the current ExceptionHandler. |
IdReference |
getId(String id)
get the element associated with the id. |
ResourceBundle |
getResourceBundle()
Gets the resource bundle used by this CookXml object. |
Object |
getRootObject()
Gets the root object associated with the xml document root element. |
TagLibrary |
getTagLibrary()
returns the tag library used by this CookXml object |
VarLookup |
getVarLookup()
returns the current VarLookup object. |
boolean |
isAccessible()
Returns if CookXml should attempt to access non-public variables. |
static boolean |
isDefaultAccessible()
Returns if CookXml by default should attempt to access non-public variables. |
void |
setAccessible(boolean accessible)
Setting this flag to true to allow this CookXml object to read/write non-public variables (including package scope, protected, and private variables). |
void |
setClassLoader(ClassLoader classLoader)
Set the ClassLaoder that is used to locate resouces. |
static void |
setDefaultAccessible(boolean accessible)
Setting this flag to true to allow CookXml to read/write non-public variables (including package scope, protected, and private variables) by default. |
static void |
setDefaultClassLoader(ClassLoader defaultClassLoader)
Set the default ClassLaoder that is used to locate resouces. |
static void |
setDefaultExceptionHandler(ExceptionHandler defaultExceptionHandler)
Sets the default ExceptionHandler for all instances of CookXml. |
void |
setDocumentBuilder(DocumentBuilder docBuilder)
sets the DocumentBuilder used by this CookXml object. |
void |
setExceptionHandler(ExceptionHandler exceptionHandler)
sets the current ExceptionHandler. |
void |
setId(String id,
String ns,
String tag,
Object obj)
Save an element with an id in a map such that this element can be referenced later. |
void |
setResourceBundle(ResourceBundle bundle)
Sets the resource bundle to be used by this CookXml object. |
void |
setRootObject(Object rootObj)
Sets the root object associated with the xml document root element. |
void |
setVarLookup(VarLookup varLookup)
sets the current VarLookup object. |
Object |
xmlDecode(Object input)
Call this function to start decoding the input. |
Object |
xmlDecode(Object input,
String parentNS,
String parentTag,
Object parentObj)
Call this function to start decoding the input. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CookXml(DocumentBuilder builder,
TagLibrary tagLibrary,
Object varObj)
builder - the document builder use to parse the xml document.tagLibrary - the tag library to be used.varObj - inside where all the variables are contained.
public CookXml(DocumentBuilder builder,
TagLibrary tagLibrary,
VarLookup varLookup)
builder - the document builder use to parse the xml document.tagLibrary - the tag library to be used.varLookup - a handler for looking up variables| Method Detail |
public static ExceptionHandler getDefaultExceptionHandler()
ExceptionHandlerpublic static void setDefaultExceptionHandler(ExceptionHandler defaultExceptionHandler)
defaultExceptionHandler - the default ExceptionHandler to be usedExceptionHandlerpublic static void setDefaultAccessible(boolean accessible)
Note, reading/writing non-public variable should be avoided for Web Start applications or applications that run in a sandbox, as such action can generate a SecurityException.
Usually, it is rather rare to have frequent access to a single variable. So, performance-wise should be okay. If you read/write a particular variable more often, consider to cache the object.
accessible - if CookXml should attempt to access non-public variablesAccessExceptionpublic static boolean isDefaultAccessible()
public static ClassLoader getDefaultClassLoader()
public static void setDefaultClassLoader(ClassLoader defaultClassLoader)
defaultClassLoader - the default ClassLoader to be used.public static boolean debug(String msg)
msg - the message to be printed.
public static boolean debug(String msg,
Exception ex)
msg - the message to be printed.ex - the exception message to be printed.
public static boolean debug(Exception ex)
ex - the exception message to be printed.
public TagLibrary getTagLibrary()
public IdReference getId(String id)
id - the id to be retrieved.
public void setId(String id,
String ns,
String tag,
Object obj)
id - the id to be saved.tag - the tag name.obj - the object associated with the tag.
public Object xmlDecode(Object input)
throws CookXmlException
input - the input source
CookXmlException
public Object xmlDecode(Object input,
String parentNS,
String parentTag,
Object parentObj)
throws CookXmlException
parentTag - the assumed parent tagparentObj - the assumed parentObjinput - the input source
CookXmlExceptionpublic Object getRootObject()
public void setRootObject(Object rootObj)
rootObj - the object to be associated with.public DocumentBuilder getDocumentBuilder()
public void setDocumentBuilder(DocumentBuilder docBuilder)
docBuilder - the DocumentBuilder to be used by this CookXml object.public ResourceBundle getResourceBundle()
public void setResourceBundle(ResourceBundle bundle)
bundle - the resource bundle to be used by the xml document.public VarLookup getVarLookup()
public void setVarLookup(VarLookup varLookup)
varLookup - the VarLookup object which is used for variable lookup.public ExceptionHandler getExceptionHandler()
public void setExceptionHandler(ExceptionHandler exceptionHandler)
exceptionHandler - the handler for exceptions.public boolean isAccessible()
public void setAccessible(boolean accessible)
Note, reading/writing non-public variable should be avoided for Web Start applications or applications that run in a sandbox, as such action can generate a SecurityException.
Usually, it is rather rare to have frequent access to a single variable. So, performance-wise should be okay. If you read/write a particular variable more often, consider to cache the object.
accessible - if CookXml should attempt to access non-public variablesAccessExceptionpublic ClassLoader getClassLoader()
public void setClassLoader(ClassLoader classLoader)
classLoader - the ClassLoader to be used.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||