public class DefaultT3dGenerator extends AbstractT3dGenerator
IT3dGenerator. Reads annotations
from package cz.cuni.amis.pogamut.unreal.t3dgenerator.annotations present
on classes that are to be serialized. Every unannotated, non-static, non-transient
member of a serialized object is treated as a property of this object.
Objects that are descendants of IUnrealReferencableByName and have
no name specified get their names autogenerated.
Properties and child objects with null values are not exported (so that defaults from archetype are applied in editor).| Constructor and Description |
|---|
DefaultT3dGenerator() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
generateHeaderProperties(Object object,
OutputStreamWriter out)
Generates a single line string of header properties of an object to an OutputStreamWriter.
|
protected void |
generateProperties(Object object,
OutputStreamWriter out,
int indent)
Generates properties of an object to an OutputStreamWriter.
|
protected void |
generateProperty(OutputStreamWriter out,
String indentString,
String propertyName,
Object propertyValue)
Generates a text for specified property to an OutputStreamWriter.
|
protected void |
generateStaticText(Object object,
OutputStreamWriter out,
int indent)
Gathers all static text properties of an object and outputs them to a specified OutputStreamWriter
|
void |
generateT3d(List elements,
OutputStreamWriter out)
Creates T3D for all specified objects.
|
protected void |
generateT3dFromDynamicObject(DynamicT3DObject object,
OutputStreamWriter out,
int indent) |
protected void |
generateT3dInternal(Object object,
OutputStreamWriter out,
int indent)
Generates T3D for an object and all it's child objects.
|
protected String |
getElementType(Object unrealObject)
Gets an element type (e.g.
|
protected List<Object> |
getChildren(Object unrealObject)
Gets a list of all child objects of a specified object.
|
protected Map<String,Object> |
getProperties(Object object)
Gets a map of properties of an object.
|
protected String |
getPropertyNameForField(Field f,
String annotationValue)
Returns a name for property in a field.
|
protected String |
getPropertyString(String key,
Object value)
Returns a string for property with name Unreal name key and specified value.
|
protected String |
getPropertyString(String key,
Object value,
boolean escapeStrings)
Returns a string for property with name Unreal name key and specified value.
|
protected String |
getPropertyValueString(Object value)
Transforms a value of a property into it's string representation, strings are escaped
with single quote.
|
protected String |
getPropertyValueString(Object value,
boolean escapeStrings)
Transforms a value of a property into it's string representation.
|
String |
getTranslatedName(Field f)
Translates a name of a field from Java naming convention to UDK naming convention.
|
protected static String |
indentString(int indent)
Create a string of tabs...
|
protected void |
preProcess(Object unrealObject,
IT3dGeneratorContext context)
Preprocesses an object before serializing it.
|
generateT3dprotected static String indentString(int indent)
indent - protected String getPropertyNameForField(Field f, String annotationValue)
f - annotationValue - the name specified in annotation or null/empty string if there is not anypublic String getTranslatedName(Field f)
f - protected void preProcess(Object unrealObject, IT3dGeneratorContext context)
IUnrealReferencableByName
and does not have a name.unrealObject - context - protected String getPropertyValueString(Object value, boolean escapeStrings)
value - escapeStrings - true, if strings should be escaped with single quote. Should be false for header fields.protected String getPropertyValueString(Object value)
value - protected String getPropertyString(String key, Object value, boolean escapeStrings)
key - value - escapeStrings - true, if strings should be escaped with single quote. Should be false for header fields.protected String getPropertyString(String key, Object value)
key - value - protected void generateProperty(OutputStreamWriter out, String indentString, String propertyName, Object propertyValue) throws IOException
out - indentString - String of tabs that should be prepended to the property string.propertyName - propertyValue - IOExceptionprotected Map<String,Object> getProperties(Object object)
object - UnrealPropertyprotected void generateProperties(Object object, OutputStreamWriter out, int indent) throws IOException
object - out - indent - IOExceptionprotected void generateHeaderProperties(Object object, OutputStreamWriter out) throws IOException
IOExceptionUnrealHeaderFieldprotected List<Object> getChildren(Object unrealObject)
unrealObject - UnrealChild,
UnrealChildCollectionprotected void generateStaticText(Object object, OutputStreamWriter out, int indent) throws IOException
object - out - indent - IOExceptionStaticTextprotected String getElementType(Object unrealObject)
unrealObject - UnrealBeanprotected void generateT3dFromDynamicObject(DynamicT3DObject object, OutputStreamWriter out, int indent) throws IOException
IOExceptionprotected void generateT3dInternal(Object object, OutputStreamWriter out, int indent) throws IOException
object - out - indent - IOExceptionpublic void generateT3d(List elements, OutputStreamWriter out) throws IOException
elements - out - IOExceptionCopyright © 2019 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All rights reserved.