|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.wtkx.WTKXSerializer
public class WTKXSerializer
Loads an object hierarchy from an XML document.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Dictionary |
---|
Dictionary.Pair<K,V> |
Field Summary | |
---|---|
static String |
DEFAULT_LANGUAGE
|
static String |
DEFINE_TAG
|
static String |
ID_ATTRIBUTE
|
static String |
INCLUDE_RESOURCES_ATTRIBUTE
|
static String |
INCLUDE_SRC_ATTRIBUTE
|
static String |
INCLUDE_TAG
|
static String |
LANGUAGE_PROCESSING_INSTRUCTION
|
static String |
MIME_TYPE
|
static char |
OBJECT_REFERENCE_PREFIX
|
static char |
RESOURCE_KEY_PREFIX
|
static String |
SCRIPT_LANGUAGE_ATTRIBUTE
|
static String |
SCRIPT_SRC_ATTRIBUTE
|
static String |
SCRIPT_TAG
|
static char |
URL_PREFIX
|
static String |
WTKX_PREFIX
|
Constructor Summary | |
---|---|
WTKXSerializer()
|
|
WTKXSerializer(Resources resources)
|
Method Summary | ||
---|---|---|
void |
bind(Object object)
Applies WTKX binding annotations to an object. |
|
void |
bind(Object object,
Class<?> type)
Applies WTKX binding annotations to an object. |
|
boolean |
containsKey(String name)
Tests the existence of a key in the dictionary. |
|
Object |
get(String name)
Retrieves a named object. |
|
URL |
getLocation()
Returns the location of the WTKX most recently processed by this serializer. |
|
String |
getMIMEType(Object object)
Returns the MIME type of the data read and written by this serializer. |
|
Resources |
getResources()
|
|
Object |
getRoot()
Retrieves the root of the object hierarchy most recently processed by this serializer. |
|
WTKXSerializer |
getSerializer(String name)
Retrieves a nested serializer. |
|
|
getValue(String name)
Provides typed access to named objects. |
|
boolean |
isEmpty()
|
|
Object |
put(String name,
Object value)
Sets the value of the given key, creating a new entry or replacing the existing value. |
|
Object |
readObject(Class<?> baseType,
String resourceName)
|
|
Object |
readObject(InputStream inputStream)
Reads an object from an input stream. |
|
Object |
readObject(Object baseObject,
String resourceName)
|
|
Object |
readObject(String resourceName)
|
|
Object |
readObject(URL location)
|
|
Object |
remove(String name)
Removes a key/value pair from the map. |
|
void |
reset()
|
|
void |
writeObject(Object object,
OutputStream outputStream)
Writes an object to an output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char URL_PREFIX
public static final char RESOURCE_KEY_PREFIX
public static final char OBJECT_REFERENCE_PREFIX
public static final String LANGUAGE_PROCESSING_INSTRUCTION
public static final String WTKX_PREFIX
public static final String ID_ATTRIBUTE
public static final String INCLUDE_TAG
public static final String INCLUDE_SRC_ATTRIBUTE
public static final String INCLUDE_RESOURCES_ATTRIBUTE
public static final String SCRIPT_TAG
public static final String SCRIPT_SRC_ATTRIBUTE
public static final String SCRIPT_LANGUAGE_ATTRIBUTE
public static final String DEFINE_TAG
public static final String DEFAULT_LANGUAGE
public static final String MIME_TYPE
Constructor Detail |
---|
public WTKXSerializer()
public WTKXSerializer(Resources resources)
Method Detail |
---|
public Resources getResources()
public Object readObject(String resourceName) throws IOException, SerializationException
IOException
SerializationException
public Object readObject(Object baseObject, String resourceName) throws IOException, SerializationException
IOException
SerializationException
public Object readObject(Class<?> baseType, String resourceName) throws IOException, SerializationException
IOException
SerializationException
public Object readObject(URL location) throws IOException, SerializationException
IOException
SerializationException
public Object readObject(InputStream inputStream) throws IOException, SerializationException
Serializer
readObject
in interface Serializer<Object>
inputStream
- The data stream from which the object will be read.
IOException
SerializationException
public void writeObject(Object object, OutputStream outputStream) throws IOException, SerializationException
Serializer
writeObject
in interface Serializer<Object>
object
- The object to serialize.outputStream
- The data stream to which the object will be written.
IOException
SerializationException
public String getMIMEType(Object object)
Serializer
getMIMEType
in interface Serializer<Object>
object
- If provided, allows the serializer to attach parameters to the returned
MIME type containing more detailed information about the data. If
null, the base MIME type is returned.public Object get(String name)
get
in interface Dictionary<String,Object>
name
- The name of the object, relative to this loader. The object's name is
the concatenation of its parent IDs and its ID, separated by periods
(e.g. "foo.bar.baz").
containsKey(String)
to distinguish
between the two cases.public <T> T getValue(String name)
get(String)
and casts
the return value to T.
name
- public Object put(String name, Object value)
Dictionary
put
in interface Dictionary<String,Object>
name
- The key whose value is to be set.value
- The value to be associated with the given key.
public Object remove(String name)
Dictionary
remove
in interface Dictionary<String,Object>
name
- The key whose mapping is to be removed.
public boolean containsKey(String name)
Dictionary
containsKey
in interface Dictionary<String,Object>
name
- The key whose presence in the dictionary is to be tested.
public boolean isEmpty()
public void reset()
public Object getRoot()
public WTKXSerializer getSerializer(String name)
name
- The name of the serializer, relative to this loader. The serializer's name
is the concatentation of its parent IDs and its ID, separated by periods
(e.g. "foo.bar.baz").
public URL getLocation()
public void bind(Object object)
object
- bind(Object, Class)
public void bind(Object object, Class<?> type) throws BindException
NOTE This method uses reflection to set internal member variables. As a result, it may only be called from trusted code.
object
- type
-
BindException
- If an error occurs during binding
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |