Package org.yaml.snakeyaml
Class TypeDescription
java.lang.Object
org.yaml.snakeyaml.TypeDescription
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
FieldsModifier and TypeFieldDescriptionprotected BeanAccess
private boolean
private Class<?>
protected String[]
private static final Logger
private Map<String,
PropertySubstitute> private PropertyUtils
private Tag
-
Constructor Summary
ConstructorsConstructorDescriptionTypeDescription
(Class<? extends Object> clazz) TypeDescription
(Class<? extends Object> clazz, Class<?> impl) TypeDescription
(Class<? extends Object> clazz, String tag) TypeDescription
(Class<? extends Object> clazz, Tag tag) TypeDescription
(Class<? extends Object> clazz, Tag tag, Class<?> impl) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPropertyParameters
(String pName, Class<?>... classes) Adds new substitute for propertypName
parameterized byclasses
to thisTypeDescription
.private void
private Property
discoverProperty
(String name) Is invoked after entity is filled with values from deserialized YAMLgetListPropertyType
(String property) Deprecated.getMapKeyType
(String property) Deprecated.getMapValueType
(String property) Deprecated.getProperty
(String name) getTag()
Get tag which shall be used to load or dump the type (class).getType()
Get represented type (class)newInstance
(String propertyName, Node node) 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.void
putListPropertyType
(String property, Class<? extends Object> type) Deprecated.void
Deprecated.void
setExcludes
(String... propNames) void
setIncludes
(String... propNames) boolean
setProperty
(Object targetBean, String propertyName, Object value) void
setPropertyUtils
(PropertyUtils propertyUtils) void
Deprecated.it will be removed because it is not usedvoid
Deprecated.it will be removed because it is not usedboolean
setupPropertyType
(String key, Node valueNode) void
substituteProperty
(String pName, Class<?> pType, String getter, String setter, Class<?>... argParams) Adds property substitute forpName
void
substituteProperty
(PropertySubstitute substitute) toString()
-
Field Details
-
log
-
type
-
impl
-
tag
-
dumpProperties
-
propertyUtils
-
delegatesChecked
private transient boolean delegatesChecked -
properties
-
excludes
-
includes
-
beanAccess
-
-
Constructor Details
-
TypeDescription
-
TypeDescription
-
TypeDescription
-
TypeDescription
-
TypeDescription
-
-
Method Details
-
getTag
Get tag which shall be used to load or dump the type (class).- Returns:
- tag to be used. It may be a tag for Language-Independent Types (http://www.yaml.org/type/)
-
setTag
Deprecated.it will be removed because it is not usedSet tag to be used dump the type (class).- Parameters:
tag
- - local or global tag
-
setTag
Deprecated.it will be removed because it is not usedSet tag to be used to dump the type (class).- Parameters:
tag
- - local or global tag
-
getType
Get represented type (class)- Returns:
- type (class) to be described.
-
putListPropertyType
Deprecated.Specify that the property is a type-safeList
.- Parameters:
property
- name of the JavaBean propertytype
- class of List values
-
getListPropertyType
Deprecated.Get class of List values for provided JavaBean property.- Parameters:
property
- property name- Returns:
- class of List values
-
putMapPropertyType
@Deprecated public void putMapPropertyType(String property, Class<? extends Object> key, Class<? extends Object> value) Deprecated.Specify that the property is a type-safeMap
.- Parameters:
property
- property name of this JavaBeankey
- class of keys in Mapvalue
- class of values in Map
-
getMapKeyType
Deprecated.Get keys type info for this JavaBean- Parameters:
property
- property name of this JavaBean- Returns:
- class of keys in the Map
-
getMapValueType
Deprecated.Get values type info for this JavaBean- Parameters:
property
- property name of this JavaBean- Returns:
- class of values in the Map
-
addPropertyParameters
Adds new substitute for propertypName
parameterized byclasses
to thisTypeDescription
. IfpName
has been added before - updates parameters withclasses
.- Parameters:
pName
- - parameter nameclasses
- - parameterized by
-
toString
-
checkDelegates
private void checkDelegates() -
discoverProperty
-
getProperty
-
substituteProperty
public void substituteProperty(String pName, Class<?> pType, String getter, String setter, Class<?>... argParams) Adds property substitute forpName
- Parameters:
pName
- property namepType
- property typegetter
- method name for gettersetter
- method name for setterargParams
- actual types for parameterized type (List<?>, Map<?>)
-
substituteProperty
-
setPropertyUtils
-
setIncludes
-
setExcludes
-
getProperties
-
setupPropertyType
-
setProperty
- Throws:
Exception
-
newInstance
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 to construct the instance from- Returns:
- new instance
-
newInstance
-
finalizeConstruction
Is invoked after entity is filled with values from deserialized YAML- Parameters:
obj
- - deserialized entity- Returns:
- postprocessed deserialized entity
-