|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.kernel.properties.PropertyPrinter
This class provides methods for printing properties, both for debugging and for writing things out to map files.
Method Summary | |
static java.util.LinkedList |
externalize(GameObject obj)
Produces a text-serialized (XML) version of the object and its properties. |
static java.util.LinkedList |
indentLineList(java.util.LinkedList lines)
Prepends 2 spaces to the beginning of every line in the list. |
static boolean |
isDefaultProperty(java.lang.String property,
GameObject obj)
Returns true if this is a default property for the given class. |
static java.util.LinkedList |
printArchProperty(java.lang.String name,
Archetype arch)
Externalizes an archetype property. |
static java.util.LinkedList |
printBeanProperty(java.lang.String property,
java.lang.Object value)
Print the value of a "Bean" property. |
static java.util.LinkedList |
printGameObjectProperty(java.lang.String name,
GameObject obj)
When a property is a GameObject, such as a MonsterInventory, we tell the object to externalize itself, and then we surgically add the "name=whatever" attribute into the |
static java.util.LinkedList |
printNormalBeanProperty(java.lang.String property,
java.lang.Object value)
Prints a regular old bean property. |
static java.util.LinkedList |
printPListBeanProperty(java.lang.String name,
PropertyList value)
Externalizes a plist-based bean property. |
static java.util.LinkedList |
printProperty(java.lang.String key,
java.lang.Object value)
Returns a String description of a property. |
static java.util.LinkedList |
printSelfExternalizable(java.lang.String name,
java.lang.Object val)
Gives a self-externalizable object a chance to print its own data. |
static java.lang.String |
stripBase(java.lang.String name)
Strips the standard property directory from the name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.util.LinkedList printProperty(java.lang.String key, java.lang.Object value)
key
- a (String) property namevalue
- the value for the property (can be null)
public static java.util.LinkedList printBeanProperty(java.lang.String property, java.lang.Object value)
property
- a property with an arbitrary object for a value
(a.k.a. a "bean value" )value
- the property value, which we use introspection to
examine.
public static java.util.LinkedList printNormalBeanProperty(java.lang.String property, java.lang.Object value)
public static java.util.LinkedList printGameObjectProperty(java.lang.String name, GameObject obj)
name
- the property nameobj
- the property value
public static java.util.LinkedList printPListBeanProperty(java.lang.String name, PropertyList value)
public static java.util.LinkedList printSelfExternalizable(java.lang.String name, java.lang.Object val)
name
- the property nameval
- the bean value
public static java.lang.String stripBase(java.lang.String name)
name
- the property name
public static java.util.LinkedList printArchProperty(java.lang.String name, Archetype arch)
name
- the property name, e.g. "spell". Can be null
if the arch has no property name, as is the case for items
in an externalized ItemList.arch
- the Archetype
public static java.util.LinkedList indentLineList(java.util.LinkedList lines)
lines
- the line list to indent
public static java.util.LinkedList externalize(GameObject obj)
Before writing the object, we call getDefaultProperties() and don't write any properties on the object that are considered defaults by the object's class.
Transient properties are not written to the stream.
This method is called by MapObject.externalize(), so it's the default persistence implementation for game objects. GameObject.externalize() is a convenience method so that objects can override the default behavior.
obj
- the object to serialize
public static boolean isDefaultProperty(java.lang.String property, GameObject obj)
obj
- the object being externalizedproperty
- the property to check for being a default
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |