|
||||||||||
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 |
DEFINE_TAG
|
static String |
ID_ATTRIBUTE
|
static String |
INCLUDE_ASYNCHRONOUS_ATTRIBUTE
|
static String |
INCLUDE_RESOURCES_ATTRIBUTE
|
static String |
INCLUDE_SRC_ATTRIBUTE
|
static String |
INCLUDE_TAG
|
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 | ||
---|---|---|
|
bind(T t,
Class<? super T> 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. |
|
int |
getLineNumber()
Returns the line number of the element currently being processed. |
|
URL |
getLocation()
Returns the location of the WTKX currently being processed. |
|
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 id)
Retrieves an include serializer by its ID. |
|
String |
getTagName()
Returns the name of the element currently being processed. |
|
ListenerList<WTKXSerializerListener> |
getWTKXSerializerListeners()
|
|
boolean |
isEmpty()
Tests the emptiness of the dictionary. |
|
Object |
put(String id,
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 id)
Removes a key/value pair from the map. |
|
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 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 INCLUDE_ASYNCHRONOUS_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 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 Object put(String id, Object value)
Dictionary
put
in interface Dictionary<String,Object>
id
- The key whose value is to be set.value
- The value to be associated with the given key.
public Object remove(String id)
Dictionary
remove
in interface Dictionary<String,Object>
id
- 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()
Dictionary
isEmpty
in interface Dictionary<String,Object>
public Object getRoot()
public WTKXSerializer getSerializer(String id)
id
- The ID of the serializer, relative to this loader. The serializer's ID
is the concatentation of its parent IDs and its ID, separated by periods
(e.g. "foo.bar.baz").
public String getTagName()
public int getLineNumber()
public URL getLocation()
public <T> void bind(T t, Class<? super T> type) throws BindException
NOTE This method uses reflection to set internal member variables. As a result, it may only be called from trusted code.
t
- type
-
BindException
- If an error occurs during bindingpublic ListenerList<WTKXSerializerListener> getWTKXSerializerListeners()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |