@Override public Object construct(Node nnode) { if (nnode.getTag() == Tag.TIMESTAMP) { Construct dateConstructor = yamlConstructors.get(Tag.TIMESTAMP); if (nnode.getType().isAssignableFrom(DateTime.class)) { Date date = (Date) dateConstructor.construct(nnode); return new DateTime(date, DateTimeZone.UTC); } else { return dateConstructor.construct(nnode); } } else { return super.construct(nnode); } }
@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 nnode) { if (nnode.getTag().equals(new Tag("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); } }
protected Construct getConstructor(Node node) { if (node.getTag().equals(new Tag("!de.oddb.org,2007/ODDB::Util::Code"))) { node.setUseClassConstructor(true); node.setType(CodeBean.class); } return super.getConstructor(node); }
private Construct getConstructor(Node node) { Class<?> cl = getClassForNode(node); if (cl.equals(Entity.class) && true) { // today's temperature is high :) cl = EntityLoadingProxy.class; } node.setType(cl); // call the constructor as if the runtime class is defined Construct constructor = yamlClassConstructors.get(node.getNodeId()); return constructor; }
/** * Unsafe version of {@link #constructObject(Node)} * * @param node Node to be constructed * * @return Java instance */ public Object unsafeConstructObject(final Node node) { final Construct constructor = this.getConstructor(node); final Object data = constructor.construct(node); if (node.isTwoStepsConstruction()) { constructor.construct2ndStep(node, data); } return data; }
public Object construct(Node node) { node.setType(BuildPathElement.class); String path = getPath(node); String buildPath = getPath(node, "buildPath"); //$NON-NLS-1$ BuildPathElement bpe = new BuildPathElement(path); Construct mappingConstruct = yamlClassConstructors.get(NodeId.mapping); mappingConstruct.construct2ndStep(node, bpe); bpe.setPath(path); bpe.setBuildPath(buildPath); return bpe; }
public Object construct(Node node) { node.setType(BundleElement.class); String path = getPath(node); BundleElement be = new BundleElement(path); Construct mappingConstruct = yamlClassConstructors.get(NodeId.mapping); mappingConstruct.construct2ndStep(node, be); be.setPath(path); return be; }
public Object construct(Node node) { node.setType(CommandElement.class); String path = getPath(node); CommandElement be = new LazyCommandElement(path); Construct mappingConstruct = yamlClassConstructors.get(NodeId.mapping); mappingConstruct.construct2ndStep(node, be); be.setPath(path); setPrefixTriggers(node, be); return be; }
public Object construct(Node node) { node.setType(SnippetElement.class); String path = getPath(node); SnippetElement be = new SnippetElement(path); Construct mappingConstruct = yamlClassConstructors.get(NodeId.mapping); mappingConstruct.construct2ndStep(node, be); be.setPath(path); setPrefixTriggers(node, be); return be; }
public Object construct(Node node) { node.setType(SnippetCategoryElement.class); String path = getPath(node); SnippetCategoryElement sce = new SnippetCategoryElement(path); Construct mappingConstruct = yamlClassConstructors.get(NodeId.mapping); mappingConstruct.construct2ndStep(node, sce); sce.setPath(path); return sce; }
public Object construct(Node node) { node.setType(MenuElement.class); String path = getPath(node); MenuElement be = new MenuElement(path); Construct mappingConstruct = yamlClassConstructors.get(NodeId.mapping); mappingConstruct.construct2ndStep(node, be); be.setPath(path); forcePathsOfChildren(be.getChildren()); return be; }
public Object construct(Node node) { node.setType(ProjectTemplateElement.class); String path = getPath(node); ProjectTemplateElement be = new ProjectTemplateElement(path); Construct mappingConstruct = yamlClassConstructors.get(NodeId.mapping); mappingConstruct.construct2ndStep(node, be); be.setPath(path); return be; }
public Object construct(Node node) { node.setType(ProjectSampleElement.class); String path = getPath(node); ProjectSampleElement be = new ProjectSampleElement(path); Construct mappingConstruct = yamlClassConstructors.get(NodeId.mapping); mappingConstruct.construct2ndStep(node, be); be.setPath(path); return be; }
public Object construct(Node node) { node.setType(EnvironmentElement.class); String path = getPath(node); EnvironmentElement be = new LazyEnvironmentElement(path); Construct mappingConstruct = yamlClassConstructors.get(NodeId.mapping); mappingConstruct.construct2ndStep(node, be); be.setPath(path); return be; }
public Object construct(Node node) { node.setType(TemplateElement.class); String path = getPath(node); TemplateElement be = new LazyTemplateElement(path); Construct mappingConstruct = yamlClassConstructors.get(NodeId.mapping); mappingConstruct.construct2ndStep(node, be); be.setPath(path); setPrefixTriggers(node, be); return be; }
public Object construct(Node node) { node.setType(ContentAssistElement.class); String path = getPath(node); ContentAssistElement be = new LazyContentAssistElement(path); Construct mappingConstruct = yamlClassConstructors.get(NodeId.mapping); mappingConstruct.construct2ndStep(node, be); be.setPath(path); setPrefixTriggers(node, be); return be; }
/** * Creates a new {@link Construct} for {@code !!binary}. * * @return the construct */ protected Construct binaryConstruct() { String linebreak = getOptions().getLineBreak().getString(); int width = getOptions().getWidth(); BaseEncoding encoding = BaseEncoding.base64() .withSeparator(linebreak, width); return new YamlBinaryNodeConstruct(getNodeFactory(), this, encoding); }
private Construct getCompactConstruct() { if (compactConstruct == null) { compactConstruct = createCompactConstruct(); } return compactConstruct; }
protected Construct createCompactConstruct() { return new ConstructCompactObject(); }
public void addConstruct(Class<?> type, Construct construct) { this.yamlConstructors.put(new Tag(type), construct); }
protected Construct getConstructor(Node node) { if (CFG.equals(node.getTag())) { node.setUseClassConstructor(false); } return super.getConstructor(node); }
@Override public Construct getConstructor(final Node node) { return super.getConstructor(node); }