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


Java NodeId类代码示例

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


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

示例1: SafeConstructor

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
public SafeConstructor() {
    this.yamlConstructors.put(Tag.NULL, new ConstructYamlNull());
    this.yamlConstructors.put(Tag.BOOL, new ConstructYamlBool());
    this.yamlConstructors.put(Tag.INT, new ConstructYamlInt());
    this.yamlConstructors.put(Tag.FLOAT, new ConstructYamlFloat());
    this.yamlConstructors.put(Tag.BINARY, new ConstructYamlBinary());
    this.yamlConstructors.put(Tag.TIMESTAMP, new ConstructYamlTimestamp());
    this.yamlConstructors.put(Tag.OMAP, new ConstructYamlOmap());
    this.yamlConstructors.put(Tag.PAIRS, new ConstructYamlPairs());
    this.yamlConstructors.put(Tag.SET, new ConstructYamlSet());
    this.yamlConstructors.put(Tag.STR, new ConstructYamlStr());
    this.yamlConstructors.put(Tag.SEQ, new ConstructYamlSeq());
    this.yamlConstructors.put(Tag.MAP, new ConstructYamlMap());
    this.yamlConstructors.put(null, undefinedConstructor);
    this.yamlClassConstructors.put(NodeId.scalar, undefinedConstructor);
    this.yamlClassConstructors.put(NodeId.sequence, undefinedConstructor);
    this.yamlClassConstructors.put(NodeId.mapping, undefinedConstructor);
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:19,代码来源:SafeConstructor.java

示例2: composeScalarNode

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
protected Node composeScalarNode(String anchor) {
    ScalarEvent ev = (ScalarEvent) parser.getEvent();
    String tag = ev.getTag();
    boolean resolved = false;
    Tag nodeTag;
    if (tag == null || tag.equals("!")) {
        nodeTag = resolver.resolve(NodeId.scalar, ev.getValue(), ev.getImplicit()
                .canOmitTagInPlainScalar());
        resolved = true;
    } else {
        nodeTag = new Tag(tag);
    }
    Node node = new ScalarNode(nodeTag, resolved, ev.getValue(), ev.getStartMark(),
            ev.getEndMark(), ev.getStyle());
    if (anchor != null) {
        anchors.put(anchor, node);
    }
    return node;
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:20,代码来源:Composer.java

示例3: composeSequenceNode

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
protected Node composeSequenceNode(String anchor) {
    SequenceStartEvent startEvent = (SequenceStartEvent) parser.getEvent();
    String tag = startEvent.getTag();
    Tag nodeTag;
    boolean resolved = false;
    if (tag == null || tag.equals("!")) {
        nodeTag = resolver.resolve(NodeId.sequence, null, startEvent.getImplicit());
        resolved = true;
    } else {
        nodeTag = new Tag(tag);
    }
    final ArrayList<Node> children = new ArrayList<Node>();
    SequenceNode node = new SequenceNode(nodeTag, resolved, children,
            startEvent.getStartMark(), null, startEvent.getFlowStyle());
    if (anchor != null) {
        anchors.put(anchor, node);
    }
    while (!parser.checkEvent(Event.ID.SequenceEnd)) {
        children.add(composeNode(node));
    }
    Event endEvent = parser.getEvent();
    node.setEndMark(endEvent.getEndMark());
    return node;
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:25,代码来源:Composer.java

示例4: composeMappingNode

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
protected Node composeMappingNode(String anchor) {
    MappingStartEvent startEvent = (MappingStartEvent) parser.getEvent();
    String tag = startEvent.getTag();
    Tag nodeTag;
    boolean resolved = false;
    if (tag == null || tag.equals("!")) {
        nodeTag = resolver.resolve(NodeId.mapping, null, startEvent.getImplicit());
        resolved = true;
    } else {
        nodeTag = new Tag(tag);
    }

    final List<NodeTuple> children = new ArrayList<NodeTuple>();
    MappingNode node = new MappingNode(nodeTag, resolved, children, startEvent.getStartMark(),
            null, startEvent.getFlowStyle());
    if (anchor != null) {
        anchors.put(anchor, node);
    }
    while (!parser.checkEvent(Event.ID.MappingEnd)) {
        composeMappingChildren(children, node);
    }
    Event endEvent = parser.getEvent();
    node.setEndMark(endEvent.getEndMark());
    return node;
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:26,代码来源:Composer.java

示例5: composeScalarNode

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
protected Node composeScalarNode(String anchor) {
    ScalarEvent ev = (ScalarEvent) parser.getEvent();
    String tag = ev.getTag();
    boolean resolved = false;
    Tag nodeTag;
    if (tag == null || tag.equals("!")) {
        nodeTag = resolver.resolve(NodeId.scalar, ev.getValue(),
                ev.getImplicit().canOmitTagInPlainScalar());
        resolved = true;
    } else {
        nodeTag = new Tag(tag);
    }
    Node node = new ScalarNode(nodeTag, resolved, ev.getValue(), ev.getStartMark(),
            ev.getEndMark(), ev.getStyle());
    if (anchor != null) {
        anchors.put(anchor, node);
    }
    return node;
}
 
开发者ID:ME1312,项目名称:SubServers-2,代码行数:20,代码来源:Composer.java

示例6: composeSequenceNode

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
protected Node composeSequenceNode(String anchor) {
    SequenceStartEvent startEvent = (SequenceStartEvent) parser.getEvent();
    String tag = startEvent.getTag();
    Tag nodeTag;
    boolean resolved = false;
    if (tag == null || tag.equals("!")) {
        nodeTag = resolver.resolve(NodeId.sequence, null, startEvent.getImplicit());
        resolved = true;
    } else {
        nodeTag = new Tag(tag);
    }
    final ArrayList<Node> children = new ArrayList<Node>();
    SequenceNode node = new SequenceNode(nodeTag, resolved, children, startEvent.getStartMark(),
            null, startEvent.getFlowStyle());
    if (anchor != null) {
        anchors.put(anchor, node);
    }
    while (!parser.checkEvent(Event.ID.SequenceEnd)) {
        children.add(composeNode(node));
    }
    Event endEvent = parser.getEvent();
    node.setEndMark(endEvent.getEndMark());
    return node;
}
 
开发者ID:ME1312,项目名称:SubServers-2,代码行数:25,代码来源:Composer.java

示例7: newYaml

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
private static Yaml newYaml() {
    return new Yaml(new Constructor(),
                    new Representer(),
                    new DumperOptions(),
                    new Resolver() {
                        @Override
                        public Tag resolve(NodeId kind, String value, boolean implicit) {
                            if (value != null) {
                                if (value.equalsIgnoreCase("on") ||
                                        value.equalsIgnoreCase("off") ||
                                        value.equalsIgnoreCase("yes") ||
                                        value.equalsIgnoreCase("no")) {
                                    return Tag.STR;
                                }
                            }
                            return super.resolve(kind, value, implicit);
                        }
                    });
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:20,代码来源:ConfigViewFactory.java

示例8: lookAhead

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
@Override
protected void lookAhead(Lexer baseLexer) {
    super.lookAhead(baseLexer);

    if (getTokenType() == YamlTokenTypes.YAML_Scalar) {
        Tag tag = resolver.resolve(NodeId.scalar, getTokenText().trim(), true);

        if (tag.equals(Tag.BOOL)) replaceCachedType(0, YamlTokenTypes.YAML_Tag_BOOL);
        else if (tag.equals(Tag.INT)) replaceCachedType(0, YamlTokenTypes.YAML_Tag_INT);
        else if (tag.equals(Tag.FLOAT)) replaceCachedType(0, YamlTokenTypes.YAML_Tag_FLOAT);
        else if (tag.equals(Tag.NULL)) replaceCachedType(0, YamlTokenTypes.YAML_Tag_NULL);
        else if (tag.equals(Tag.TIMESTAMP)) replaceCachedType(0, YamlTokenTypes.YAML_Tag_TIMESTAMP);

        if (baseLexer.getTokenType() == YamlTokenTypes.YAML_Value) {
            replaceCachedType(0, YamlTokenTypes.YAML_Key);
        }
    }
}
 
开发者ID:vermut,项目名称:intellij-snakeyaml,代码行数:19,代码来源:YamlHighlightingLexer.java

示例9: composeScalarNode

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
private Node composeScalarNode(String anchor) {
    ScalarEvent ev = (ScalarEvent) parser.getEvent();
    String tag = ev.getTag();
    boolean resolved = false;
    Tag nodeTag;
    if (tag == null || tag.equals("!")) {
        nodeTag = resolver.resolve(NodeId.scalar, ev.getValue(), ev.getImplicit()
                .canOmitTagInPlainScalar());
        resolved = true;
    } else {
        nodeTag = new Tag(tag);
    }
    Node node = new ScalarNode(nodeTag, resolved, ev.getValue(), ev.getStartMark(),
            ev.getEndMark(), ev.getStyle());
    if (anchor != null) {
        anchors.put(anchor, node);
    }
    return node;
}
 
开发者ID:cuizhennan,项目名称:snakeyaml,代码行数:20,代码来源:Composer.java

示例10: composeSequenceNode

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
private Node composeSequenceNode(String anchor) {
    SequenceStartEvent startEvent = (SequenceStartEvent) parser.getEvent();
    String tag = startEvent.getTag();
    Tag nodeTag;
    boolean resolved = false;
    if (tag == null || tag.equals("!")) {
        nodeTag = resolver.resolve(NodeId.sequence, null, startEvent.getImplicit());
        resolved = true;
    } else {
        nodeTag = new Tag(tag);
    }
    final ArrayList<Node> children = new ArrayList<Node>();
    SequenceNode node = new SequenceNode(nodeTag, resolved, children,
            startEvent.getStartMark(), null, startEvent.getFlowStyle());
    if (anchor != null) {
        anchors.put(anchor, node);
    }
    while (!parser.checkEvent(Event.ID.SequenceEnd)) {
        children.add(composeNode(node));
    }
    Event endEvent = parser.getEvent();
    node.setEndMark(endEvent.getEndMark());
    return node;
}
 
开发者ID:cuizhennan,项目名称:snakeyaml,代码行数:25,代码来源:Composer.java

示例11: representJavaBeanProperty

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
@Override // Skip null values for configuration generating
protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object value, Tag customTag) {
    if (value != null) {
        NodeTuple tuple = super.representJavaBeanProperty(javaBean, property, value, customTag);
        Node valueNode = tuple.getValueNode();

        // Avoid using tags for enums
        if (customTag == null && valueNode.getNodeId() == NodeId.scalar && value instanceof Enum<?>) {
            valueNode.setTag(Tag.STR);
        }

        return tuple;
    } else {
        return null;
    }
}
 
开发者ID:Minecrell,项目名称:ServerListPlus,代码行数:17,代码来源:ConfigurationRepresenter.java

示例12: composeScalarNode

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
private Node composeScalarNode(final String anchor) {
	ScalarEvent ev = (ScalarEvent) parser.getEvent();
	String tag = ev.getTag();
	boolean resolved = false;
	Tag nodeTag;
	if (tag == null || tag.equals("!")) {
		nodeTag = resolver.resolve(NodeId.scalar, ev.getValue(), ev.getImplicit().canOmitTagInPlainScalar());
		resolved = true;
	} else {
		nodeTag = new Tag(tag);
	}
	Node node = new ScalarNode(nodeTag, resolved, ev.getValue(), ev.getStartMark(), ev.getEndMark(), ev.getStyle());
	if (anchor != null) {
		anchors.put(anchor, node);
	}
	return node;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:18,代码来源:Composer.java

示例13: composeSequenceNode

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
private Node composeSequenceNode(final String anchor) {
	SequenceStartEvent startEvent = (SequenceStartEvent) parser.getEvent();
	String tag = startEvent.getTag();
	Tag nodeTag;
	boolean resolved = false;
	if (tag == null || tag.equals("!")) {
		nodeTag = resolver.resolve(NodeId.sequence, null, startEvent.getImplicit());
		resolved = true;
	} else {
		nodeTag = new Tag(tag);
	}
	final ArrayList<Node> children = new ArrayList<Node>();
	SequenceNode node = new SequenceNode(nodeTag, resolved, children, startEvent.getStartMark(), null, startEvent.getFlowStyle());
	if (anchor != null) {
		anchors.put(anchor, node);
	}
	int index = 0;
	while (!parser.checkEvent(Event.ID.SequenceEnd)) {
		children.add(composeNode(node));
		index++;
	}
	Event endEvent = parser.getEvent();
	node.setEndMark(endEvent.getEndMark());
	return node;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:26,代码来源:Composer.java

示例14: SafeConstructor

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
public SafeConstructor() {
	this.yamlConstructors.put(Tag.NULL, new ConstructYamlNull());
	this.yamlConstructors.put(Tag.BOOL, new ConstructYamlBool());
	this.yamlConstructors.put(Tag.INT, new ConstructYamlInt());
	this.yamlConstructors.put(Tag.FLOAT, new ConstructYamlFloat());
	this.yamlConstructors.put(Tag.BINARY, new ConstructYamlBinary());
	this.yamlConstructors.put(Tag.TIMESTAMP, new ConstructYamlTimestamp());
	this.yamlConstructors.put(Tag.OMAP, new ConstructYamlOmap());
	this.yamlConstructors.put(Tag.PAIRS, new ConstructYamlPairs());
	this.yamlConstructors.put(Tag.SET, new ConstructYamlSet());
	this.yamlConstructors.put(Tag.STR, new ConstructYamlStr());
	this.yamlConstructors.put(Tag.SEQ, new ConstructYamlSeq());
	this.yamlConstructors.put(Tag.MAP, new ConstructYamlMap());
	this.yamlConstructors.put(null, undefinedConstructor);
	this.yamlClassConstructors.put(NodeId.scalar, undefinedConstructor);
	this.yamlClassConstructors.put(NodeId.sequence, undefinedConstructor);
	this.yamlClassConstructors.put(NodeId.mapping, undefinedConstructor);
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:19,代码来源:SafeConstructor.java

示例15: representJavaBeanProperty

import org.yaml.snakeyaml.nodes.NodeId; //导入依赖的package包/类
/**
 * Represent one JavaBean property.
 * 
 * @param javaBean
 *            - the instance to be represented
 * @param property
 *            - the property of the instance
 * @param propertyValue
 *            - value to be represented
 * @param customTag
 *            - user defined Tag
 * @return NodeTuple to be used in a MappingNode. Return null to skip the
 *         property
 */
protected NodeTuple representJavaBeanProperty(Object javaBean, Property property,
        Object propertyValue, Tag customTag) {
    ScalarNode nodeKey = (ScalarNode) representData(property.getName());
    // the first occurrence of the node must keep the tag
    boolean hasAlias = this.representedObjects.containsKey(propertyValue);

    Node nodeValue = representData(propertyValue);

    if (propertyValue != null && !hasAlias) {
        NodeId nodeId = nodeValue.getNodeId();
        if (customTag == null) {
            if (nodeId == NodeId.scalar) {
                if (propertyValue instanceof Enum<?>) {
                    nodeValue.setTag(Tag.STR);
                }
            } else {
                if (nodeId == NodeId.mapping) {
                    if (property.getType() == propertyValue.getClass()) {
                        if (!(propertyValue instanceof Map<?, ?>)) {
                            if (!nodeValue.getTag().equals(Tag.SET)) {
                                nodeValue.setTag(Tag.MAP);
                            }
                        }
                    }
                }
                checkGlobalTag(property, nodeValue, propertyValue);
            }
        }
    }

    return new NodeTuple(nodeKey, nodeValue);
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:47,代码来源:Representer.java


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