org.yaml.snakeyaml.representer
Class Representer

java.lang.Object
  extended by org.yaml.snakeyaml.representer.BaseRepresenter
      extended by org.yaml.snakeyaml.representer.Representer

public class Representer
extends BaseRepresenter

Represent JavaBeans


Nested Class Summary
protected  class Representer.RepresentJavaBean
           
 
Field Summary
static Pattern BINARY_PATTERN
           
protected  Map<Class<? extends Object>,String> classTags
           
 
Fields inherited from class org.yaml.snakeyaml.representer.BaseRepresenter
defaultFlowStyle, multiRepresenters, nullRepresenter, objectToRepresent, representedObjects, representers
 
Constructor Summary
Representer()
           
 
Method Summary
 String addClassTag(Class<? extends Object> clazz, String tag)
          Define a tag for the Class to serialize
protected  void checkGlobalTag(Property property, Node node, Object object)
          Remove redundant global tag for a type safe (generic) collection if it is the same as defined by the JavaBean property
protected  Set<Property> getProperties(Class<? extends Object> type)
           
protected  boolean ignoreAliases(Object data)
           
protected  Node representJavaBean(Set<Property> properties, Object javaBean)
          Tag logic:
- explicit root tag is set in serializer
- if there is a predefined class tag it is used
- a global tag with class name is always used as tag.
 
Methods inherited from class org.yaml.snakeyaml.representer.BaseRepresenter
represent, representData, representMapping, representScalar, representScalar, representSequence, setDefaultFlowStyle, setDefaultScalarStyle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classTags

protected Map<Class<? extends Object>,String> classTags

BINARY_PATTERN

public static Pattern BINARY_PATTERN
Constructor Detail

Representer

public Representer()
Method Detail

representJavaBean

protected Node representJavaBean(Set<Property> properties,
                                 Object javaBean)
Tag logic:
- explicit root tag is set in serializer
- if there is a predefined class tag it is used
- a global tag with class name is always used as tag. The JavaBean parent of the specified JavaBean may set another tag (tag:yaml.org,2002:map) when the property class is the same as runtime class

Parameters:
properties - JavaBean getters
javaBean - instance for Node
Returns:
Node to get serialized

checkGlobalTag

protected void checkGlobalTag(Property property,
                              Node node,
                              Object object)
Remove redundant global tag for a type safe (generic) collection if it is the same as defined by the JavaBean property

Parameters:
property - - JavaBean property
node - - representation of the property
object - - instance represented by the node

getProperties

protected Set<Property> getProperties(Class<? extends Object> type)
                               throws IntrospectionException
Throws:
IntrospectionException

ignoreAliases

protected boolean ignoreAliases(Object data)
Specified by:
ignoreAliases in class BaseRepresenter

addClassTag

public String addClassTag(Class<? extends Object> clazz,
                          String tag)
Define a tag for the Class to serialize

Parameters:
clazz - Class which tag is changed
tag - new tag to be used for every instance of the specified Class
Returns:
the previous tag associated with the Class


Copyright © 2008-2010. All Rights Reserved.