本文整理匯總了Java中org.yaml.snakeyaml.introspector.Property.get方法的典型用法代碼示例。如果您正苦於以下問題:Java Property.get方法的具體用法?Java Property.get怎麽用?Java Property.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.yaml.snakeyaml.introspector.Property
的用法示例。
在下文中一共展示了Property.get方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: representJavaBean
import org.yaml.snakeyaml.introspector.Property; //導入方法依賴的package包/類
/**
* Tag logic:<br/>
* - explicit root tag is set in serializer <br/>
* - if there is a predefined class tag it is used<br/>
* - 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
*
* @param properties
* JavaBean getters
* @param javaBean
* instance for Node
* @return Node to get serialized
*/
protected MappingNode representJavaBean(Set<Property> properties, Object javaBean) {
List<NodeTuple> value = new ArrayList<NodeTuple>(properties.size());
Tag tag;
Tag customTag = classTags.get(javaBean.getClass());
tag = customTag != null ? customTag : new Tag(javaBean.getClass());
// flow style will be chosen by BaseRepresenter
MappingNode node = new MappingNode(tag, value, null);
representedObjects.put(javaBean, node);
boolean bestStyle = true;
for (Property property : properties) {
Object memberValue = property.get(javaBean);
Tag customPropertyTag = memberValue == null ? null : classTags.get(memberValue
.getClass());
NodeTuple tuple = representJavaBeanProperty(javaBean, property, memberValue,
customPropertyTag);
if (tuple == null) {
continue;
}
if (((ScalarNode) tuple.getKeyNode()).getStyle() != null) {
bestStyle = false;
}
Node nodeValue = tuple.getValueNode();
if (!(nodeValue instanceof ScalarNode && ((ScalarNode) nodeValue).getStyle() == null)) {
bestStyle = false;
}
value.add(tuple);
}
if (defaultFlowStyle != FlowStyle.AUTO) {
node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
} else {
node.setFlowStyle(bestStyle);
}
return node;
}
示例2: representJavaBean
import org.yaml.snakeyaml.introspector.Property; //導入方法依賴的package包/類
/**
* 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
*
* @param properties
* JavaBean getters
* @param javaBean
* instance for Node
* @return Node to get serialized
*/
protected MappingNode representJavaBean(Set<Property> properties, Object javaBean) {
List<NodeTuple> value = new ArrayList<NodeTuple>(properties.size());
Tag tag;
Tag customTag = classTags.get(javaBean.getClass());
tag = customTag != null ? customTag : new Tag(javaBean.getClass());
// flow style will be chosen by BaseRepresenter
MappingNode node = new MappingNode(tag, value, null);
representedObjects.put(javaBean, node);
boolean bestStyle = true;
for (Property property : properties) {
Object memberValue = property.get(javaBean);
Tag customPropertyTag = memberValue == null ? null : classTags.get(memberValue
.getClass());
NodeTuple tuple = representJavaBeanProperty(javaBean, property, memberValue,
customPropertyTag);
if (tuple == null) {
continue;
}
if (((ScalarNode) tuple.getKeyNode()).getStyle() != null) {
bestStyle = false;
}
Node nodeValue = tuple.getValueNode();
if (!(nodeValue instanceof ScalarNode && ((ScalarNode) nodeValue).getStyle() == null)) {
bestStyle = false;
}
value.add(tuple);
}
if (defaultFlowStyle != FlowStyle.AUTO) {
node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
} else {
node.setFlowStyle(bestStyle);
}
return node;
}
示例3: representJavaBean
import org.yaml.snakeyaml.introspector.Property; //導入方法依賴的package包/類
@Override
protected MappingNode representJavaBean(Set<Property> properties, Object javaBean) {
List<NodeTuple> value = new ArrayList<>(properties.size());
Tag tag;
Tag customTag = classTags.get(javaBean.getClass());
tag = customTag != null ? customTag : new Tag(javaBean.getClass());
MappingNode node = new MappingNode(tag, value, null);
representedObjects.put(javaBean, node);
boolean bestStyle = true;
List<Property> orderProperties = new ArrayList<>(properties);
orderProperties.sort(sorter);
for (Property property : orderProperties) {
Object memberValue = property.get(javaBean);
Tag customPropertyTag = memberValue == null ? null
: classTags.get(memberValue.getClass());
NodeTuple tuple = representJavaBeanProperty(javaBean, property, memberValue,
customPropertyTag);
if (tuple == null) {
continue;
}
if (((ScalarNode) tuple.getKeyNode()).getStyle() != null) {
bestStyle = false;
}
org.yaml.snakeyaml.nodes.Node nodeValue = tuple.getValueNode();
if (!(nodeValue instanceof ScalarNode && ((ScalarNode) nodeValue).getStyle() == null)) {
bestStyle = false;
}
value.add(tuple);
}
if (defaultFlowStyle != FlowStyle.AUTO) {
node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
} else {
node.setFlowStyle(bestStyle);
}
return node;
}
示例4: representJavaBean
import org.yaml.snakeyaml.introspector.Property; //導入方法依賴的package包/類
/**
* Tag logic:<br>
* - explicit root tag is set in serializer <br>
* - if there is a predefined class tag it is used<br>
* - 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
*
* @param properties
* JavaBean getters
* @param javaBean
* instance for Node
* @return Node to get serialized
*/
protected MappingNode representJavaBean(Set<Property> properties, Object javaBean) {
List<NodeTuple> value = new ArrayList<NodeTuple>(properties.size());
Tag tag;
Tag customTag = classTags.get(javaBean.getClass());
tag = customTag != null ? customTag : new Tag(javaBean.getClass());
// flow style will be chosen by BaseRepresenter
MappingNode node = new MappingNode(tag, value, null);
representedObjects.put(javaBean, node);
boolean bestStyle = true;
for (Property property : properties) {
Object memberValue = property.get(javaBean);
Tag customPropertyTag = memberValue == null ? null : classTags.get(memberValue
.getClass());
NodeTuple tuple = representJavaBeanProperty(javaBean, property, memberValue,
customPropertyTag);
if (tuple == null) {
continue;
}
if (((ScalarNode) tuple.getKeyNode()).getStyle() != null) {
bestStyle = false;
}
Node nodeValue = tuple.getValueNode();
if (!(nodeValue instanceof ScalarNode && ((ScalarNode) nodeValue).getStyle() == null)) {
bestStyle = false;
}
value.add(tuple);
}
if (defaultFlowStyle != FlowStyle.AUTO) {
node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
} else {
node.setFlowStyle(bestStyle);
}
return node;
}
示例5: representJavaBean
import org.yaml.snakeyaml.introspector.Property; //導入方法依賴的package包/類
/**
* Tag logic:<br/>
* - explicit root tag is set in serializer <br/>
* - if there is a predefined class tag it is used<br/>
* - 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
*
* @param properties
* JavaBean getters
* @param javaBean
* instance for Node
* @return Node to get serialized
*/
protected MappingNode representJavaBean(Set<Property> properties, Object javaBean) {
List<NodeTuple> value = new ArrayList<NodeTuple>(properties.size());
Tag tag;
Tag customTag = classTags.get(javaBean.getClass());
tag = customTag != null ? customTag : new Tag(javaBean.getClass());
// flow style will be chosen by BaseRepresenter
MappingNode node = new MappingNode(tag, value, null);
representedObjects.put(javaBean, node);
boolean bestStyle = true;
for (Property property : properties) {
Object memberValue = property.get(javaBean);
Tag customPropertyTag = memberValue == null ? null : classTags.get(memberValue
.getClass());
NodeTuple tuple = representJavaBeanProperty(javaBean, property, memberValue,
customPropertyTag);
if (tuple == null) {
continue;
}
if (((ScalarNode) tuple.getKeyNode()).getStyle() != null) {
bestStyle = false;
}
Node nodeValue = tuple.getValueNode();
if (!((nodeValue instanceof ScalarNode && ((ScalarNode) nodeValue).getStyle() == null))) {
bestStyle = false;
}
value.add(tuple);
}
if (defaultFlowStyle != FlowStyle.AUTO) {
node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
} else {
node.setFlowStyle(bestStyle);
}
return node;
}
示例6: representJavaBean
import org.yaml.snakeyaml.introspector.Property; //導入方法依賴的package包/類
/**
* Tag logic:<br>
* - explicit root tag is set in serializer <br>
* - if there is a predefined class tag it is used<br>
* - 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
*
* @param properties
* JavaBean getters
* @param javaBean
* instance for Node
*
* @return Node to get serialized
*/
protected MappingNode representJavaBean(Set<Property> properties, Object javaBean)
{
List<NodeTuple> value = new ArrayList<>(properties.size());
Tag tag;
Tag customTag = this.classTags.get(javaBean.getClass());
tag = (customTag != null) ? customTag : new Tag(javaBean.getClass());
// flow style will be chosen by BaseRepresenter
MappingNode node = new MappingNode(tag, value, null);
this.representedObjects.put(javaBean, node);
boolean bestStyle = true;
for (Property property : properties)
{
Object memberValue = property.get(javaBean);
Tag customPropertyTag = (memberValue == null) ? null : this.classTags.get(memberValue.getClass());
NodeTuple tuple = this.representJavaBeanProperty(javaBean, property, memberValue, customPropertyTag);
if (tuple == null)
{
continue;
}
if (((ScalarNode) tuple.getKeyNode()).getStyle() != null)
{
bestStyle = false;
}
Node nodeValue = tuple.getValueNode();
if (! ((nodeValue instanceof ScalarNode) && (((ScalarNode) nodeValue).getStyle() == null)))
{
bestStyle = false;
}
value.add(tuple);
}
if (this.defaultFlowStyle != FlowStyle.AUTO)
{
node.setFlowStyle(this.defaultFlowStyle.getStyleBoolean());
}
else
{
node.setFlowStyle(bestStyle);
}
return node;
}