当前位置: 首页>>代码示例>>Java>>正文


Java MappingNode.setFlowStyle方法代码示例

本文整理汇总了Java中org.yaml.snakeyaml.nodes.MappingNode.setFlowStyle方法的典型用法代码示例。如果您正苦于以下问题:Java MappingNode.setFlowStyle方法的具体用法?Java MappingNode.setFlowStyle怎么用?Java MappingNode.setFlowStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.yaml.snakeyaml.nodes.MappingNode的用法示例。


在下文中一共展示了MappingNode.setFlowStyle方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: representMapping

import org.yaml.snakeyaml.nodes.MappingNode; //导入方法依赖的package包/类
protected Node representMapping(Tag tag, Map<?, ?> mapping, Boolean flowStyle) {
    List<NodeTuple> value = new ArrayList<NodeTuple>(mapping.size());
    MappingNode node = new MappingNode(tag, value, flowStyle);
    representedObjects.put(objectToRepresent, node);
    boolean bestStyle = true;
    for (Map.Entry<?, ?> entry : mapping.entrySet()) {
        Node nodeKey = representData(entry.getKey());
        Node nodeValue = representData(entry.getValue());
        if (!(nodeKey instanceof ScalarNode && ((ScalarNode) nodeKey).getStyle() == null)) {
            bestStyle = false;
        }
        if (!(nodeValue instanceof ScalarNode && ((ScalarNode) nodeValue).getStyle() == null)) {
            bestStyle = false;
        }
        value.add(new NodeTuple(nodeKey, nodeValue));
    }
    if (flowStyle == null) {
        if (defaultFlowStyle != FlowStyle.AUTO) {
            node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
        } else {
            node.setFlowStyle(bestStyle);
        }
    }
    return node;
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:26,代码来源:BaseRepresenter.java

示例2: representMapping

import org.yaml.snakeyaml.nodes.MappingNode; //导入方法依赖的package包/类
protected Node representMapping(Tag tag, Map<? extends Object, Object> mapping,
        Boolean flowStyle) {
    List<NodeTuple> value = new ArrayList<NodeTuple>(mapping.size());
    MappingNode node = new MappingNode(tag, value, flowStyle);
    representedObjects.put(objectToRepresent, node);
    boolean bestStyle = true;
    for (Map.Entry<? extends Object, Object> entry : mapping.entrySet()) {
        Node nodeKey = representData(entry.getKey());
        Node nodeValue = representData(entry.getValue());
        if (!((nodeKey instanceof ScalarNode && ((ScalarNode) nodeKey).getStyle() == null))) {
            bestStyle = false;
        }
        if (!((nodeValue instanceof ScalarNode && ((ScalarNode) nodeValue).getStyle() == null))) {
            bestStyle = false;
        }
        value.add(new NodeTuple(nodeKey, nodeValue));
    }
    if (flowStyle == null) {
        if (defaultFlowStyle != FlowStyle.AUTO) {
            node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
        } else {
            node.setFlowStyle(bestStyle);
        }
    }
    return node;
}
 
开发者ID:timvisee,项目名称:TestTheTeacher,代码行数:27,代码来源:BaseRepresenter.java

示例3: representMapping

import org.yaml.snakeyaml.nodes.MappingNode; //导入方法依赖的package包/类
protected Node representMapping(final Tag tag, final Map<?, ?> mapping, final Boolean flowStyle) {
	List<NodeTuple> value = new ArrayList<NodeTuple>(mapping.size());
	MappingNode node = new MappingNode(tag, value, flowStyle);
	representedObjects.put(objectToRepresent, node);
	boolean bestStyle = true;
	for (Map.Entry<?, ?> entry : mapping.entrySet()) {
		Node nodeKey = representData(entry.getKey());
		Node nodeValue = representData(entry.getValue());
		if (!((nodeKey instanceof ScalarNode && ((ScalarNode) nodeKey).getStyle() == null))) {
			bestStyle = false;
		}
		if (!((nodeValue instanceof ScalarNode && ((ScalarNode) nodeValue).getStyle() == null))) {
			bestStyle = false;
		}
		value.add(new NodeTuple(nodeKey, nodeValue));
	}
	if (flowStyle == null) {
		if (defaultFlowStyle != FlowStyle.AUTO) {
			node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
		} else {
			node.setFlowStyle(bestStyle);
		}
	}
	return node;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:26,代码来源:BaseRepresenter.java

示例4: delegate

import org.yaml.snakeyaml.nodes.MappingNode; //导入方法依赖的package包/类
/**
 * Create a {@link MappingNode} from the specified entries and tag.
 *
 * @param tag     the tag
 * @param mapping the entries
 *
 * @return the mapping node
 */
private MappingNode delegate(Tag tag,
                             Iterable<Entry<YamlNode, YamlNode>> mapping) {
    List<NodeTuple> value = new LinkedList<>();
    MappingNode node = new MappingNode(tag, value, null);
    representedObjects.put(objectToRepresent, node);
    boolean bestStyle = true;
    for (Map.Entry<?, ?> entry : mapping) {
        Node nodeKey = representData(entry.getKey());
        Node nodeValue = representData(entry.getValue());
        bestStyle = bestStyle(nodeKey, bestStyle);
        bestStyle = bestStyle(nodeValue, bestStyle);
        value.add(new NodeTuple(nodeKey, nodeValue));
    }

    if (getDefaultFlowStyle() != FlowStyle.AUTO) {
        node.setFlowStyle(getDefaultFlowStyle().getStyleBoolean());
    } else {
        node.setFlowStyle(bestStyle);
    }
    return node;
}
 
开发者ID:autermann,项目名称:yaml,代码行数:30,代码来源:YamlNodeRepresenter.java

示例5: representJavaBean

import org.yaml.snakeyaml.nodes.MappingNode; //导入方法依赖的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;
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:49,代码来源:Representer.java

示例6: representJavaBean

import org.yaml.snakeyaml.nodes.MappingNode; //导入方法依赖的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;
}
 
开发者ID:RoccoDev,项目名称:5zig-TIMV-Plugin,代码行数:49,代码来源:Representer.java

示例7: representJavaBean

import org.yaml.snakeyaml.nodes.MappingNode; //导入方法依赖的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;
}
 
开发者ID:FlowCI,项目名称:flow-platform,代码行数:39,代码来源:NodeUtil.java

示例8: representJavaBean

import org.yaml.snakeyaml.nodes.MappingNode; //导入方法依赖的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;
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:49,代码来源:Representer.java

示例9: representJavaBean

import org.yaml.snakeyaml.nodes.MappingNode; //导入方法依赖的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;
}
 
开发者ID:timvisee,项目名称:TestTheTeacher,代码行数:49,代码来源:Representer.java

示例10: representMapping

import org.yaml.snakeyaml.nodes.MappingNode; //导入方法依赖的package包/类
@Override
public Node representMapping(Tag tag, Map<?, ?> mapping, @Nullable Boolean flowStyle)
{
    List<NodeTuple> value = new ArrayList<>(mapping.size());
    MappingNode node = new MappingNode(tag, value, flowStyle);
    this.representedObjects.put(this.objectToRepresent, node);
    boolean bestStyle = true;
    for (Map.Entry<?, ?> entry : mapping.entrySet())
    {
        Node nodeKey = this.representData(entry.getKey());
        Node nodeValue;
        if (entry.getValue() != null)
        {
            nodeValue = this.representData(entry.getValue());
        }
        else
        {
            nodeValue = this.representScalar(Tag.NULL, "~");
        }
        if (! ((nodeKey instanceof ScalarNode) && (((ScalarNode) nodeKey).getStyle() == null)))
        {
            bestStyle = false;
        }
        if (! ((nodeValue instanceof ScalarNode) && (((ScalarNode) nodeValue).getStyle() == null)))
        {
            bestStyle = false;
        }
        value.add(new NodeTuple(nodeKey, nodeValue));
    }
    if (flowStyle == null)
    {
        if (this.defaultFlowStyle != FlowStyle.AUTO)
        {
            node.setFlowStyle(this.defaultFlowStyle.getStyleBoolean());
        }
        else
        {
            node.setFlowStyle(bestStyle);
        }
    }
    return node;
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:43,代码来源:Representer.java

示例11: representJavaBean

import org.yaml.snakeyaml.nodes.MappingNode; //导入方法依赖的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;
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:56,代码来源:Representer.java


注:本文中的org.yaml.snakeyaml.nodes.MappingNode.setFlowStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。