Java Code Examples for org.yaml.snakeyaml.nodes.Node#getTag()

The following examples show how to use org.yaml.snakeyaml.nodes.Node#getTag() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Representer.java    From onedev with MIT License 5 votes vote down vote up
private void resetTag(Class<? extends Object> type, Node node) {
    Tag tag = node.getTag();
    if (tag.matches(type)) {
        if (Enum.class.isAssignableFrom(type)) {
            node.setTag(Tag.STR);
        } else {
            node.setTag(Tag.MAP);
        }
    }
}
 
Example 2
Source File: Representer.java    From orion.server with Eclipse Public License 1.0 5 votes vote down vote up
private void resetTag(Class<? extends Object> type, Node node) {
    Tag tag = node.getTag();
    if (tag.matches(type)) {
        if (Enum.class.isAssignableFrom(type)) {
            node.setTag(Tag.STR);
        } else {
            node.setTag(Tag.MAP);
        }
    }
}
 
Example 3
Source File: Constructor.java    From orion.server with Eclipse Public License 1.0 5 votes vote down vote up
public void construct2ndStep(Node node, Object object) {
    try {
        getConstructor(node).construct2ndStep(node, object);
    } catch (Exception e) {
        throw new ConstructorException(null, null,
                "Can't construct a second step for a java object for " + node.getTag()
                        + "; exception=" + e.getMessage(), node.getStartMark(), e);
    }
}
 
Example 4
Source File: Representer.java    From snake-yaml with Apache License 2.0 5 votes vote down vote up
private void resetTag(Class<? extends Object> type, Node node) {
    Tag tag = node.getTag();
    if (tag.matches(type)) {
        if (Enum.class.isAssignableFrom(type)) {
            node.setTag(Tag.STR);
        } else {
            node.setTag(Tag.MAP);
        }
    }
}
 
Example 5
Source File: Constructor.java    From snake-yaml with Apache License 2.0 5 votes vote down vote up
public void construct2ndStep(Node node, Object object) {
    try {
        getConstructor(node).construct2ndStep(node, object);
    } catch (Exception e) {
        throw new ConstructorException(null, null,
                "Can't construct a second step for a java object for " + node.getTag()
                        + "; exception=" + e.getMessage(), node.getStartMark(), e);
    }
}
 
Example 6
Source File: Representer.java    From Diorite with MIT License 5 votes vote down vote up
private void resetTag(Class<?> type, Node node)
{
    Tag tag = node.getTag();
    if (tag.matches(type))
    {
        if (Enum.class.isAssignableFrom(type))
        {
            node.setTag(Tag.STR);
        }
        else
        {
            node.setTag(Tag.MAP);
        }
    }
}
 
Example 7
Source File: YamlDeserializationData.java    From Diorite with MIT License 5 votes vote down vote up
@Nullable
public Tag getTag(String key)
{
    Node node = this.getNode(this.node, key);
    if (node == null)
    {
        return null;
    }
    return node.getTag();
}
 
Example 8
Source File: YamlParameterizedConstructor.java    From digdag with Apache License 2.0 5 votes vote down vote up
public Object construct(Node node)
{
    switch (node.getTag().getValue()) {
    case "!include":
        // TODO use implicit resolver (Resolver.addImplicitResolver) to convert "<include: path.dig" to new Tag("!include")?
        return "!include:" + java.util.UUID.randomUUID().toString();
    }
    throw new TagException(
            "could not determine a constructor for the tag " + node.getTag(),
            node.getStartMark());
}
 
Example 9
Source File: YamlParameterizedConstructor.java    From digdag with Apache License 2.0 5 votes vote down vote up
private String validateScalar(Node node)
{
    if (node.isTwoStepsConstruction()) {
        throw new TagException("'"+node.getTag()+"' cannot be recursive.",
                node.getStartMark());
    }
    if (!node.getNodeId().equals(NodeId.scalar)) {
        throw new TagException("'"+node.getTag()+"' must be a string.",
                node.getStartMark());
    }
    return ((ScalarNode) node).getValue().toString();
}
 
Example 10
Source File: SafeConstructor.java    From orion.server with Eclipse Public License 1.0 4 votes vote down vote up
public Object construct(Node node) {
    throw new ConstructorException(null, null,
            "could not determine a constructor for the tag " + node.getTag(),
            node.getStartMark());
}
 
Example 11
Source File: SafeConstructor.java    From snake-yaml with Apache License 2.0 4 votes vote down vote up
public Object construct(Node node) {
    throw new ConstructorException(null, null,
            "could not determine a constructor for the tag " + node.getTag(),
            node.getStartMark());
}
 
Example 12
Source File: AnchorGeneratorTest.java    From snake-yaml with Apache License 2.0 4 votes vote down vote up
public String nextAnchor(Node node) {
    if (node.getTag() == Tag.SEQ)
        return "list-" + super.nextAnchor(node);
    else
        return super.nextAnchor(node);
}