public class JavaBeansUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
JavaBeansUtil.BeanWriter
BeanWriter is the generic way of writing a java bean out.
|
static class |
JavaBeansUtil.HtmlBeanWriter |
static class |
JavaBeansUtil.IndentingBeanWriter
The methods in this class will do proper XML indention for you.
|
static class |
JavaBeansUtil.XmlBeanWriter |
| Modifier and Type | Method and Description |
|---|---|
static Object |
convertValue(Class type,
String value)
Convert a textual representation of type stored in value into a
java object.
|
static void |
copyBean(Object src,
Object dest)
Find matching properties between these 2 beans and copy over the
contents.
|
static void |
copyBean(Object src,
Object dest,
Map nameMapping)
Find matching properties between these 2 beans and copy over the
contents.
|
static Object |
dummyBean(Class cls,
int arraySize)
Create a bean with dummy values.
|
static Object |
dummyValue(Class type,
int arraySize) |
static void |
genReadType(Writer out,
String typeName)
Used for generating Java code for reading complicated types.
|
static void |
genWriteType(Writer out,
String typeName)
Used for generating Java code for writing complicated types.
|
static boolean |
isJavaBeanType(Class type)
Determine if type is a java bean or not.
|
static Object |
readBean(Class cls,
Document document)
Construct a new cls and fill in it's contents from document.
|
static Object |
readBean(Class cls,
InputStream in)
Construct a new cls and fill in it's contents from in.
|
static void |
readBean(Object obj,
Document document)
Fill in the contents of obj from the XML that's in document.
|
static void |
readBean(Object obj,
InputSource in,
boolean validate,
EntityResolver er,
ErrorHandler eh) |
static void |
readBean(Object obj,
InputStream in)
Fill in the contents of obj from the XML that's in in.
|
static void |
readBean(Object obj,
Node node) |
static void |
readBeanNoEntityResolver(Object obj,
InputStream in)
Warning: in readNoEntityResolver character and entity references will
not be read from any DTD in the XML source.
|
static void |
writeBean(Object obj,
JavaBeansUtil.BeanWriter out) |
static void |
writeBean(Object obj,
JavaBeansUtil.BeanWriter out,
Map skipChildren) |
static void |
writeBean(Object obj,
Writer out)
This method is similar to writeBeanProperty except that the
outer property name is not known and not printed.
|
static void |
writeBeanProperty(Object obj,
JavaBeansUtil.BeanWriter out,
Map skipChildren,
String propertyName) |
static void |
writeBeanProperty(Object obj,
JavaBeansUtil.BeanWriter out,
String propertyName)
If you want to write the java bean out in a different way from
the standard XML writer, use this method.
|
static void |
writeBeanProperty(Object obj,
Writer out,
String propertyName)
This is the normal top level method for taking a Java Bean and
dumping it as XML.
|
public static void writeBeanProperty(Object obj, Writer out, String propertyName) throws IOException, IntrospectionException
obj - the java bean to write outout - the place to write it topropertyName - the top level propertyIOExceptionIntrospectionExceptionpublic static void writeBeanProperty(Object obj, JavaBeansUtil.BeanWriter out, String propertyName) throws IOException, IntrospectionException
IOExceptionIntrospectionExceptionpublic static void writeBeanProperty(Object obj, JavaBeansUtil.BeanWriter out, Map skipChildren, String propertyName) throws IOException, IntrospectionException
IOExceptionIntrospectionExceptionpublic static void writeBean(Object obj, Writer out) throws IOException, IntrospectionException
IOExceptionIntrospectionExceptionpublic static void writeBean(Object obj, JavaBeansUtil.BeanWriter out) throws IOException, IntrospectionException
IOExceptionIntrospectionExceptionpublic static void writeBean(Object obj, JavaBeansUtil.BeanWriter out, Map skipChildren) throws IOException, IntrospectionException
IOExceptionIntrospectionExceptionpublic static Object readBean(Class cls, InputStream in) throws ParserConfigurationException, SAXException, IOException, IntrospectionException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
cls - the Class to construct from the XML.in - the source of the XML.ParserConfigurationExceptionSAXExceptionIOExceptionIntrospectionExceptionNoSuchMethodExceptionInstantiationExceptionIllegalAccessExceptionInvocationTargetExceptionpublic static void readBean(Object obj, InputStream in) throws ParserConfigurationException, SAXException, IOException, IntrospectionException
obj - the object to fill in from the XML.in - the source of the XML.ParserConfigurationExceptionSAXExceptionIOExceptionIntrospectionExceptionpublic static void readBeanNoEntityResolver(Object obj, InputStream in) throws ParserConfigurationException, SAXException, IOException, IntrospectionException
public static void readBean(Object obj, InputSource in, boolean validate, EntityResolver er, ErrorHandler eh) throws ParserConfigurationException, SAXException, IOException, IntrospectionException
public static Object readBean(Class cls, Document document) throws IntrospectionException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException
cls - the Class to construct from the XML.document - the source of the XML.IntrospectionExceptionNoSuchMethodExceptionInstantiationExceptionIllegalAccessExceptionInvocationTargetExceptionpublic static void readBean(Object obj, Document document) throws IntrospectionException
obj - the object to fill in from the XML.document - the source of the XML.IntrospectionExceptionpublic static void readBean(Object obj, Node node) throws IntrospectionException
IntrospectionExceptionpublic static void copyBean(Object src, Object dest) throws IntrospectionException
IntrospectionExceptionpublic static void copyBean(Object src, Object dest, Map nameMapping) throws IntrospectionException
nameMapping - maps property names from the src object to the dest object.IntrospectionExceptionpublic static boolean isJavaBeanType(Class type)
public static Object convertValue(Class type, String value)
public static void genReadType(Writer out, String typeName) throws IOException
typeName - the java type to generate the method about, can also
be "base64Binary".IOExceptionpublic static void genWriteType(Writer out, String typeName) throws IOException
typeName - the java type to generate the method about, can also
be "base64Binary".IOExceptionpublic static Object dummyBean(Class cls, int arraySize) throws IntrospectionException
IntrospectionExceptionCopyright © 2017–2019 Eclipse Foundation. All rights reserved.