Top Description Fields Constructors Methods
org.yaml.snakeyaml

public Class TypeDescription

extends Object
Class Inheritance
Imports
java.util.Collection, .Collections, .HashSet, .LinkedHashMap, .LinkedHashSet, .Map, .Set, org.yaml.snakeyaml.error.YAMLException, org.yaml.snakeyaml.internal.Logger, org.yaml.snakeyaml.introspector.BeanAccess, .Property, .PropertySubstitute, .PropertyUtils, org.yaml.snakeyaml.nodes.Node, .Tag

Provides additional runtime information necessary to create a custom Java instance. In general this class is thread-safe and can be used as a singleton, the only exception being the PropertyUtils field. A singleton PropertyUtils should be constructed and shared between all YAML Constructors used if a singleton TypeDescription is used, since Constructor sets its propertyUtils to the TypeDescription that is passed to it, hence you may end up in a situation when propertyUtils in TypeDescription is from different Constructor.

Field Summary

Modifier and TypeField and Description
protected BeanAccess
private transient boolean
private transient Set<Property>
protected Set<String>
private Class<?>
protected String[]
private static final Logger
private Map<String, PropertySubstitute>
private transient PropertyUtils
private final Tag
private final Class<? extends Object>

Constructor Summary

AccessConstructor and Description
public
TypeDescription(Class<? extends Object> clazz, Tag tag)

public
TypeDescription(Class<? extends Object> clazz, Tag tag, Class<?> impl)

public
TypeDescription(Class<? extends Object> clazz, String tag)

public
TypeDescription(Class<? extends Object> clazz)

public
TypeDescription(Class<? extends Object> clazz, Class<?> impl)

Method Summary

Modifier and TypeMethod and Description
public void
addPropertyParameters(String
- parameter name
pName
,
Class<?>...
- parameterized by
classes
)

Adds new substitute for property pName parameterized by classes to this TypeDescription.

private void
private Property
public Object

Returns:

postprocessed deserialized entity
finalizeConstruction
(Object
- deserialized entity
obj
)

Is invoked after entity is filled with values from deserialized YAML

public Set<Property>
public Property
public Tag

Returns:

tag to be used. It may be a tag for Language-Independent Types (http://www.yaml.org/type/)
getTag
()

Get tag which shall be used to load or dump the type (class).

public Class<? extends Object>

Returns:

type (class) to be described.
getType
()

Get represented type (class)

public Object

Returns:

new instance
newInstance
(Node
- node to construct the instance from
node
)

This method should be overridden for TypeDescription implementations that are supposed to implement instantiation logic that is different from default one as implemented in YAML constructors.

public Object
newInstance(String propertyName, Node node)

public void
putListPropertyType(String
name of the JavaBean property
property
,
Class<? extends Object>
class of List values
type
)

Deprecated
Specify that the property is a type-safe List.
public void
putMapPropertyType(String
property name of this JavaBean
property
,
Class<? extends Object>
class of keys in Map
key
,
Class<? extends Object>
class of values in Map
value
)

Deprecated
Specify that the property is a type-safe Map.
public void
setExcludes(String... propNames)

public void
setIncludes(String... propNames)

public boolean
setProperty(Object targetBean, String propertyName, Object value)

public void
public boolean
setupPropertyType(String key, Node valueNode)

public void
substituteProperty(String
property name
pName
,
Class<?>
property type
pType
,
String
method name for getter
getter
,
String
method name for setter
setter
,
Class<?>...
actual types for parameterized type (List<?>, Map<?>)
argParams
)

Adds property substitute for pName

public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

beanAccessback to summary
protected BeanAccess beanAccess
delegatesCheckedback to summary
private transient boolean delegatesChecked
dumpPropertiesback to summary
private transient Set<Property> dumpProperties
excludesback to summary
protected Set<String> excludes
implback to summary
private Class<?> impl
includesback to summary
protected String[] includes
logback to summary
private static final Logger log
propertiesback to summary
private Map<String, PropertySubstitute> properties
propertyUtilsback to summary
private transient PropertyUtils propertyUtils
tagback to summary
private final Tag tag
typeback to summary
private final Class<? extends Object> type

Constructor Detail

TypeDescriptionback to summary
public TypeDescription(Class<? extends Object> clazz, Tag tag)
TypeDescriptionback to summary
public TypeDescription(Class<? extends Object> clazz, Tag tag, Class<?> impl)
TypeDescriptionback to summary
public TypeDescription(Class<? extends Object> clazz, String tag)
TypeDescriptionback to summary
public TypeDescription(Class<? extends Object> clazz)
TypeDescriptionback to summary
public TypeDescription(Class<? extends Object> clazz, Class<?> impl)

Method Detail

addPropertyParametersback to summary
public void addPropertyParameters(String pName, Class<?>... classes)

Adds new substitute for property pName parameterized by classes to this TypeDescription. If pName has been added before - updates parameters with classes.

Parameters
pName:String

- parameter name

classes:Class<?>[]

- parameterized by

checkDelegatesback to summary
private void checkDelegates()
discoverPropertyback to summary
private Property discoverProperty(String name)
finalizeConstructionback to summary
public Object finalizeConstruction(Object obj)

Is invoked after entity is filled with values from deserialized YAML

Parameters
obj:Object

- deserialized entity

Returns:Object

postprocessed deserialized entity

getPropertiesback to summary
public Set<Property> getProperties()
getPropertyback to summary
public Property getProperty(String name)
getTagback to summary
public Tag getTag()

Get tag which shall be used to load or dump the type (class).

Returns:Tag

tag to be used. It may be a tag for Language-Independent Types (http://www.yaml.org/type/)

getTypeback to summary
public Class<? extends Object> getType()

Get represented type (class)

Returns:Class<? extends Object>

type (class) to be described.

newInstanceback to summary
public Object newInstance(Node node)

This method should be overridden for TypeDescription implementations that are supposed to implement instantiation logic that is different from default one as implemented in YAML constructors. Note that even if you override this method, default filling of fields with variables from parsed YAML will still occur later.

Parameters
node:Node

- node to construct the instance from

Returns:Object

new instance

newInstanceback to summary
public Object newInstance(String propertyName, Node node)
putListPropertyTypeback to summary
public void putListPropertyType(String property, Class<? extends Object> type)

Deprecated

Specify that the property is a type-safe List.

Parameters
property:String

name of the JavaBean property

type:Class<? extends Object>

class of List values

Annotations
@Deprecated
putMapPropertyTypeback to summary
public void putMapPropertyType(String property, Class<? extends Object> key, Class<? extends Object> value)

Deprecated

Specify that the property is a type-safe Map.

Parameters
property:String

property name of this JavaBean

key:Class<? extends Object>

class of keys in Map

value:Class<? extends Object>

class of values in Map

Annotations
@Deprecated
setExcludesback to summary
public void setExcludes(String... propNames)
setIncludesback to summary
public void setIncludes(String... propNames)
setPropertyback to summary
public boolean setProperty(Object targetBean, String propertyName, Object value) throws Exception
setPropertyUtilsback to summary
public void setPropertyUtils(PropertyUtils propertyUtils)
setupPropertyTypeback to summary
public boolean setupPropertyType(String key, Node valueNode)
substitutePropertyback to summary
public void substituteProperty(String pName, Class<?> pType, String getter, String setter, Class<?>... argParams)

Adds property substitute for pName

Parameters
pName:String

property name

pType:Class<?>

property type

getter:String

method name for getter

setter:String

method name for setter

argParams:Class<?>[]

actual types for parameterized type (List<?>, Map<?>)

substitutePropertyback to summary
public void substituteProperty(PropertySubstitute substitute)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override