@Override public Object construct(Node node) { if (node.getType().equals(XmlSuite.ParallelMode.class)) { String parallel = constructScalar((ScalarNode) node); return XmlSuite.ParallelMode.getValidParallel(parallel); } if (node.getType().equals(XmlSuite.FailurePolicy.class)) { String failurePolicy = constructScalar((ScalarNode) node); return XmlSuite.FailurePolicy.getValidPolicy(failurePolicy); } return super.construct(node); } }
public Constructor(TypeDescription theRoot, Collection<TypeDescription> moreTDs) { if (theRoot == null) { throw new NullPointerException("Root type must be provided."); } this.yamlConstructors.put(null, new ConstructYamlObject()); if (!Object.class.equals(theRoot.getType())) { rootTag = new Tag(theRoot.getType()); } yamlClassConstructors.put(NodeId.scalar, new ConstructScalar()); yamlClassConstructors.put(NodeId.mapping, new ConstructMapping()); yamlClassConstructors.put(NodeId.sequence, new ConstructSequence()); addTypeDescription(theRoot); if (moreTDs != null) { for (TypeDescription td : moreTDs) { addTypeDescription(td); } } }
|| type == UUID.class) { result = constructStandardJavaInstance(type, node); } else { argument = constructStandardJavaInstance(javaConstructor.getParameterTypes()[0], node); } else {
|| type == UUID.class) { result = constructStandardJavaInstance(type, node); } else { argument = constructStandardJavaInstance(javaConstructor.getParameterTypes()[0], node); } else {
|| Tag.BINARY.equals(node.getTag()) || Calendar.class.isAssignableFrom(type)) { result = constructStandardJavaInstance(type, node); } else { throw new YAMLException("No single argument constructor found for " + type); } else if (oneArgCount == 1) { argument = constructStandardJavaInstance( javaConstructor.getParameterTypes()[0], node); } else {
|| Tag.BINARY.equals(node.getTag()) || Calendar.class.isAssignableFrom(type) || type == UUID.class) { result = constructStandardJavaInstance(type, node); } else { throw new YAMLException("No single argument constructor found for " + type); } else if (oneArgCount == 1) { argument = constructStandardJavaInstance( javaConstructor.getParameterTypes()[0], node); } else {
@Override public Object construct(Node node) { final Class<? extends Object> type = node.getType(); if (type == Path.class) { return Paths.get(((ScalarNode) node).getValue()); } else if (type == Duration.class) { return Duration.of(((ScalarNode) node).getValue()); } else if (type == CharStreamSource.class) { return CharStreamSource.of(((ScalarNode) node).getValue()); } else if (type == SrcVersion.class) { return SrcVersion.parseRef(((ScalarNode) node).getValue()); } else if (type == Pattern.class) { return Pattern.compile(((ScalarNode) node).getValue()); } else { return super.construct(node); } } }
@Override public Object construct(Node node) { if (node.getType() == PortBinding.class) { String value = constructScalar((ScalarNode) node).toString(); return PortBinding.valueOf(value); } else if (node.getType() == ExposedPort.class) { String value = constructScalar((ScalarNode) node).toString(); return ExposedPort.valueOf(value); } else if (node.getType() == Image.class) { String value = constructScalar((ScalarNode) node).toString(); return Image.valueOf(value); } else if (node.getType() == Link.class) { String value = constructScalar((ScalarNode) node).toString(); return Link.valueOf(value); } return super.construct(node); } }
public Constructor(TypeDescription theRoot, Collection<TypeDescription> moreTDs) { if (theRoot == null) { throw new NullPointerException("Root type must be provided."); } this.yamlConstructors.put(null, new ConstructYamlObject()); if (!Object.class.equals(theRoot.getType())) { rootTag = new Tag(theRoot.getType()); } yamlClassConstructors.put(NodeId.scalar, new ConstructScalar()); yamlClassConstructors.put(NodeId.mapping, new ConstructMapping()); yamlClassConstructors.put(NodeId.sequence, new ConstructSequence()); addTypeDescription(theRoot); if (moreTDs != null) { for (TypeDescription td : moreTDs) { addTypeDescription(td); } } }
@Override public Object construct(Node node) { if (node.getType() == PortBinding.class) { String value = constructScalar((ScalarNode) node).toString(); return PortBinding.valueOf(value); } else if (node.getType() == ExposedPort.class) { String value = constructScalar((ScalarNode) node).toString(); return ExposedPort.valueOf(value); } else if (node.getType() == Image.class) { String value = constructScalar((ScalarNode) node).toString(); return Image.valueOf(value); } else if (node.getType() == Link.class) { String value = constructScalar((ScalarNode) node).toString(); return Link.valueOf(value); } return super.construct(node); } }
public Constructor(TypeDescription theRoot) { if (theRoot == null) { throw new NullPointerException("Root type must be provided."); } this.yamlConstructors.put(null, new ConstructYamlObject()); if (!Object.class.equals(theRoot.getType())) { rootTag = new Tag(theRoot.getType()); } typeTags = new HashMap<Tag, Class<? extends Object>>(); typeDefinitions = new HashMap<Class<? extends Object>, TypeDescription>(); yamlClassConstructors.put(NodeId.scalar, new ConstructScalar()); yamlClassConstructors.put(NodeId.mapping, new ConstructMapping()); yamlClassConstructors.put(NodeId.sequence, new ConstructSequence()); addTypeDescription(theRoot); }
public Constructor(TypeDescription theRoot) { if (theRoot == null) { throw new NullPointerException("Root type must be provided."); } this.yamlConstructors.put(null, new ConstructYamlObject()); if (!Object.class.equals(theRoot.getType())) { rootTag = new Tag(theRoot.getType()); } typeTags = new HashMap<Tag, Class<? extends Object>>(); typeDefinitions = new HashMap<Class<? extends Object>, TypeDescription>(); yamlClassConstructors.put(NodeId.scalar, new ConstructScalar()); yamlClassConstructors.put(NodeId.mapping, new ConstructMapping()); yamlClassConstructors.put(NodeId.sequence, new ConstructSequence()); addTypeDescription(theRoot); }
@Override public Object construct(Node node) { if (node.getType() == Path.class) { ScalarNode snode = (ScalarNode) node; return Paths.get(snode.getValue()); } else { return super.construct(node); } } }
@Override public Object construct(Node nnode) { if (nnode.getTag().equals("tag:yaml.org,2002:timestamp")) { Construct dateConstructor = yamlConstructors.get(Tag.TIMESTAMP); Date date = (Date) dateConstructor.construct(nnode); return new DateTime(date, DateTimeZone.UTC); } else { return super.construct(nnode); } } }
@Override public Object construct(Node node) { if (node.getType().equals(XmlSuite.ParallelMode.class)) { String parallel = (String) constructScalar((ScalarNode) node); return XmlSuite.ParallelMode.getValidParallel(parallel); } if (node.getType().equals(XmlSuite.FailurePolicy.class)) { String failurePolicy = (String) constructScalar((ScalarNode) node); return XmlSuite.FailurePolicy.getValidPolicy(failurePolicy); } return super.construct(node); } }