@Override public boolean equals(Object obj) { if (obj instanceof Tag) { return value.equals(((Tag) obj).getValue()); } else return false; }
ImplicitTuple tuple = new ImplicitTuple(node.getTag().equals(detectedTag), node .getTag().equals(defaultTag)); ScalarEvent event = new ScalarEvent(tAlias, node.getTag().getValue(), tuple, scalarNode.getValue(), null, null, scalarNode.getStyle()); this.emitter.emit(event); boolean implicitS = node.getTag().equals(this.resolver.resolve(NodeId.sequence, null, true)); this.emitter.emit(new SequenceStartEvent(tAlias, node.getTag().getValue(), implicitS, null, null, seqNode.getFlowStyle())); List<Node> list = seqNode.getValue(); Tag implicitTag = this.resolver.resolve(NodeId.mapping, null, true); boolean implicitM = node.getTag().equals(implicitTag); this.emitter.emit(new MappingStartEvent(tAlias, node.getTag().getValue(), implicitM, null, null, ((CollectionNode) node).getFlowStyle())); MappingNode mnode = (MappingNode) node;
@Override public boolean equals(Object obj) { if (obj instanceof Tag) { return value.equals(((Tag) obj).getValue()); } else return false; }
@Override public boolean equals(Object obj) { if (obj instanceof Tag) { return value.equals(((Tag) obj).getValue()); } else return false; }
public int compareTo(Tag o) { return value.compareTo(o.getValue()); } }
@Override public boolean equals(Object obj) { if (obj instanceof Tag) { return value.equals(((Tag) obj).getValue()); } else return false; }
public int compareTo(Tag o) { return value.compareTo(o.getValue()); } }
<T> void addExplicit(final Tag tag, final Explicit<T> explicit) { final BuilderConstruct<T> ctor = new BuilderConstruct<>( explicit); yamlConstructors.put(tag, ctor); yamlMultiConstructors.put(tag.getValue(), ctor); }
private void validateKeys(MappingNode node) { Map<String, Long> keyCounts = node.getValue().stream() .map(NodeTuple::getKeyNode) .filter(n -> n instanceof ScalarNode) .map(ScalarNode.class::cast) .filter(n -> !"!include".equals(n.getTag().getValue())) // exclude !include tag .collect(Collectors.groupingBy(ScalarNode::getValue, Collectors.counting())); List<String> duplicatedKeys = keyCounts.entrySet().stream() .filter(it -> it.getValue() > 1) .map(Map.Entry<String, Long>::getKey) .collect(Collectors.toList()); if (!duplicatedKeys.isEmpty()) { throw new DuplicateKeyYAMLException(duplicatedKeys); } } }
public IncludeInfo(Tag tag) { StringBuilder encodedInclude = new StringBuilder(tag.getValue()); endColumn = popTrailingNumber(encodedInclude); startColumn = popTrailingNumber(encodedInclude); line = popTrailingNumber(encodedInclude); includeName = encodedInclude.substring(IncludeResolver.INCLUDE_APPLIED_TAG.length()); }
public IncludeInfo(Tag tag) { StringBuilder encodedInclude = new StringBuilder(tag.getValue()); endColumn = popTrailingNumber(encodedInclude); startColumn = popTrailingNumber(encodedInclude); line = popTrailingNumber(encodedInclude); includeName = encodedInclude.substring(IncludeResolver.INCLUDE_APPLIED_TAG.length()); }
public static List<IncludeInfo> unmarshall(Tag tag) { String compoundIncludeTag = tag.getValue().substring(INCLUDE_COMPOUND_APPLIED_TAG.length()); int endOfFirstLength = compoundIncludeTag.indexOf(SEPARATOR); int firstIncludeLength = Integer.parseInt(compoundIncludeTag.substring(0, endOfFirstLength)); String firstAppliedInclude = compoundIncludeTag.substring(endOfFirstLength + 1, endOfFirstLength + 1 + firstIncludeLength); IncludeInfo firstIncludeInfo = new IncludeInfo(new Tag(firstAppliedInclude)); String compoundIncludeTag1 = compoundIncludeTag.substring(endOfFirstLength + 1 + firstIncludeLength + 1); int endOfSecondLength = compoundIncludeTag1.indexOf(SEPARATOR); int secondIncludeLength = Integer.parseInt(compoundIncludeTag1.substring(0, endOfSecondLength)); String secondAppliedInclude = compoundIncludeTag1.substring(endOfSecondLength + 1, endOfSecondLength + 1 + secondIncludeLength); IncludeInfo secondIncludeInfo = new IncludeInfo(new Tag(secondAppliedInclude)); return Lists.newArrayList(firstIncludeInfo, secondIncludeInfo); }
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()); }
private void updateIncludeTag(Node templateValue, Tag parentTag) { if (parentTag.startsWith(INCLUDE_APPLIED_TAG)) { Tag currentTag = templateValue.getTag(); if (currentTag.startsWith(INCLUDE_APPLIED_TAG)) { String parentTagValue = parentTag.getValue(); String currentTagValue = currentTag.getValue(); templateValue.setTag(new Tag(INCLUDE_COMPOUND_APPLIED_TAG // + parentTagValue.length() + SEPARATOR + parentTagValue // + SEPARATOR // + currentTagValue.length() + SEPARATOR + currentTagValue)); } else { templateValue.setTag(parentTag); } } }
for (Subtype subtype : subtypes) { if (!subtype.tag().isEmpty()) { if (subtype.tag().equals(node.getTag().getValue())) { node.setType(subtype.type()); node.setTag(new Tag(subtype.type()));
final Matcher definitionReferenceMatcher = INHERITANCE_PATTERN.matcher(node.getTag().getValue()); if (!definitionReferenceMatcher.matches()) { reportProblem( .withTitle("Mis-configured definition dependency") .withDetails(String.format("Tag [%s] does not match the inheritance pattern !inherit:<type>:<referenceId>", node.getTag().getValue())) .build()); return baseData;
final Matcher resourcePathMatcher = INCLUSION_MATCHER.matcher(node.getTag().getValue()); if (!resourcePathMatcher.matches()) { reportProblem( .withTitle("Mis-configured YAML resource dependency") .withDetails(String.format("Tag [%s] does not match the inclusion pattern !include:<yaml_resource_path>", node.getTag().getValue())) .build()); return baseData;
ImplicitTuple tuple = new ImplicitTuple(node.getTag().equals(detectedTag), node .getTag().equals(defaultTag)); ScalarEvent event = new ScalarEvent(tAlias, node.getTag().getValue(), tuple, scalarNode.getValue(), null, null, scalarNode.getStyle()); this.emitter.emit(event); boolean implicitS = node.getTag().equals(this.resolver.resolve(NodeId.sequence, null, true)); this.emitter.emit(new SequenceStartEvent(tAlias, node.getTag().getValue(), implicitS, null, null, seqNode.getFlowStyle())); List<Node> list = seqNode.getValue(); Tag implicitTag = this.resolver.resolve(NodeId.mapping, null, true); boolean implicitM = node.getTag().equals(implicitTag); this.emitter.emit(new MappingStartEvent(tAlias, node.getTag().getValue(), implicitM, null, null, ((CollectionNode) node).getFlowStyle())); MappingNode mnode = (MappingNode) node;
ImplicitTuple tuple = new ImplicitTuple(node.getTag().equals(detectedTag), node .getTag().equals(defaultTag)); ScalarEvent event = new ScalarEvent(tAlias, node.getTag().getValue(), tuple, scalarNode.getValue(), null, null, scalarNode.getStyle()); this.emitter.emit(event); boolean implicitS = node.getTag().equals(this.resolver.resolve(NodeId.sequence, null, true)); this.emitter.emit(new SequenceStartEvent(tAlias, node.getTag().getValue(), implicitS, null, null, seqNode.getFlowStyle())); List<Node> list = seqNode.getValue(); Tag implicitTag = this.resolver.resolve(NodeId.mapping, null, true); boolean implicitM = node.getTag().equals(implicitTag); this.emitter.emit(new MappingStartEvent(tAlias, node.getTag().getValue(), implicitM, null, null, ((CollectionNode) node).getFlowStyle())); MappingNode mnode = (MappingNode) node;
ImplicitTuple tuple = new ImplicitTuple(node.getTag().equals(detectedTag), node .getTag().equals(defaultTag)); ScalarEvent event = new ScalarEvent(tAlias, node.getTag().getValue(), tuple, scalarNode.getValue(), null, null, scalarNode.getStyle()); this.emitter.emit(event); boolean implicitS = node.getTag().equals(this.resolver.resolve(NodeId.sequence, null, true)); this.emitter.emit(new SequenceStartEvent(tAlias, node.getTag().getValue(), implicitS, null, null, seqNode.getFlowStyle())); List<Node> list = seqNode.getValue(); Tag implicitTag = this.resolver.resolve(NodeId.mapping, null, true); boolean implicitM = node.getTag().equals(implicitTag); this.emitter.emit(new MappingStartEvent(tAlias, node.getTag().getValue(), implicitM, null, null, ((CollectionNode) node).getFlowStyle())); MappingNode mnode = (MappingNode) node;