org.yaml.snakeyaml.representer

## Class Representer

- java.lang.Object
- - org.yaml.snakeyaml.representer.BaseRepresenter
  - - org.yaml.snakeyaml.representer.Representer

    public class Representer
    extends BaseRepresenter

Represent JavaBeans

### Nested Class Summary

Nested Classes
`protected class` `Representer.RepresentJavaBean`

### Field Summary

Fields
`protected Map<Class<? extends Object>,Tag>` `classTags`
`protected DumperOptions.NonPrintableStyle` `nonPrintableStyle`
`protected TimeZone` `timeZone`
`protected Map<Class<? extends Object>,TypeDescription>` `typeDefinitions`

### Fields inherited from class org.yaml.snakeyaml.representer.BaseRepresenter

`defaultFlowStyle, defaultScalarStyle, multiRepresenters, nullRepresenter, objectToRepresent, representedObjects, representers`

### Constructor Summary

Constructors
Constructor and Description
`Representer()`
`Representer(DumperOptions options)`

### Method Summary

Methods
`Tag` `addClassTag(Class<? extends Object> clazz, Tag tag)` Define a tag for the `Class` to serialize.
`TypeDescription` `addTypeDescription(TypeDescription td)`
`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)` Get JavaBean properties to be serialised.
`protected Tag` `getTag(Class<?> clazz, Tag defaultTag)`
`TimeZone` `getTimeZone()`
`protected MappingNode` `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.
`protected NodeTuple` `representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag)` Represent one JavaBean property.
`void` `setPropertyUtils(PropertyUtils propertyUtils)`
`void` `setTimeZone(TimeZone timeZone)`

### Methods inherited from class org.yaml.snakeyaml.representer.BaseRepresenter

`getDefaultFlowStyle, getDefaultScalarStyle, getPropertyUtils, isExplicitPropertyUtils, 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

#### typeDefinitions

    protected Map<Class<? extends Object>,TypeDescription> typeDefinitions

#### classTags

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

#### timeZone

    protected TimeZone timeZone

#### nonPrintableStyle

    protected DumperOptions.NonPrintableStyle nonPrintableStyle

### Constructor Detail

#### Representer

    public Representer()

#### Representer

    public Representer(DumperOptions options)

### Method Detail

#### addTypeDescription

    public TypeDescription addTypeDescription(TypeDescription td)

#### setPropertyUtils

    public void setPropertyUtils(PropertyUtils propertyUtils)

Overrides:
  `setPropertyUtils` in class `BaseRepresenter`

#### representJavaBean

    protected MappingNode 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

#### representJavaBeanProperty

    protected NodeTuple representJavaBeanProperty(Object javaBean,
                                      Property property,
                                      Object propertyValue,
                                      Tag customTag)

Represent one JavaBean property.

Parameters:
  `javaBean` - - the instance to be represented
  `property` - - the property of the instance
  `propertyValue` - - value to be represented
  `customTag` - - user defined Tag
Returns:
  NodeTuple to be used in a MappingNode. Return null to skip the property

#### 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)

Get JavaBean properties to be serialised. The order is respected. This method may be overridden to provide custom property selection or order.

Parameters:
  `type` - - JavaBean to inspect the properties
Returns:
  properties to serialise

#### getTag

    protected Tag getTag(Class<?> clazz,
             Tag defaultTag)

#### addClassTag

    public Tag addClassTag(Class<? extends Object> clazz,
                  Tag 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`

#### getTimeZone

    public TimeZone getTimeZone()

#### setTimeZone

    public void setTimeZone(TimeZone timeZone)