Java Code Examples for org.yaml.snakeyaml.DumperOptions.FlowStyle#BLOCK

The following examples show how to use org.yaml.snakeyaml.DumperOptions.FlowStyle#BLOCK . 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: XmlBuildSpecMigrator.java    From onedev with MIT License 6 votes vote down vote up
private static Node migrateJobDependency(Element jobDependencyElement) {
	List<NodeTuple> tuples = new ArrayList<>();
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "jobName"), 
			new ScalarNode(Tag.STR, jobDependencyElement.elementText("jobName").trim())));
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "requireSuccessful"), 
			new ScalarNode(Tag.STR, jobDependencyElement.elementText("requireSuccessful").trim())));
	Element artifactsElement = jobDependencyElement.element("artifacts");
	if (artifactsElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "artifacts"), 
				new ScalarNode(Tag.STR, artifactsElement.getText().trim())));
	}
	
	List<Node> paramSupplyNodes = migrateParamSupplies(jobDependencyElement.element("jobParams").elements());
	if (!paramSupplyNodes.isEmpty()) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "jobParams"), 
				new SequenceNode(Tag.SEQ, paramSupplyNodes, FlowStyle.BLOCK)));
	}
	return new MappingNode(Tag.MAP, tuples, FlowStyle.BLOCK);
}
 
Example 2
Source File: XmlBuildSpecMigrator.java    From onedev with MIT License 6 votes vote down vote up
private static Node migrateDefaultMultiValueProvider(Element defaultMultiValueProviderElement) {
	List<NodeTuple> tuples = new ArrayList<>();
	String classTag = getClassTag(defaultMultiValueProviderElement.attributeValue("class"));
	Element scriptNameElement = defaultMultiValueProviderElement.element("scriptName");
	if (scriptNameElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "scriptName"), 
				new ScalarNode(Tag.STR, scriptNameElement.getText().trim())));
	}
	Element valueElement = defaultMultiValueProviderElement.element("value");
	if (valueElement != null) {
		List<Node> valueItemNodes = new ArrayList<>();
		for (Element valueItemElement: valueElement.elements())
			valueItemNodes.add(new ScalarNode(Tag.STR, valueItemElement.getText().trim()));
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "value"), 
				new SequenceNode(Tag.SEQ, valueItemNodes, FlowStyle.BLOCK)));
	}
	
	return new MappingNode(new Tag(classTag), tuples, FlowStyle.BLOCK);
}
 
Example 3
Source File: XmlBuildSpecMigrator.java    From onedev with MIT License 6 votes vote down vote up
private static Node migrateDefaultValueProvider(Element defaultValueProviderElement) {
	List<NodeTuple> tuples = new ArrayList<>();
	String classTag = getClassTag(defaultValueProviderElement.attributeValue("class"));
	Element scriptNameElement = defaultValueProviderElement.element("scriptName");
	if (scriptNameElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "scriptName"), 
				new ScalarNode(Tag.STR, scriptNameElement.getText().trim())));
	}
	Element valueElement = defaultValueProviderElement.element("value");
	if (valueElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "value"), 
				new ScalarNode(Tag.STR, valueElement.getText().trim())));
	}
	
	return new MappingNode(new Tag(classTag), tuples, FlowStyle.BLOCK);
}
 
Example 4
Source File: XmlBuildSpecMigrator.java    From onedev with MIT License 5 votes vote down vote up
private static Node migrateCache(Element cacheElement) {
	List<NodeTuple> tuples = new ArrayList<>();
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "key"), 
			new ScalarNode(Tag.STR, cacheElement.elementText("key").trim())));
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "path"), 
			new ScalarNode(Tag.STR, cacheElement.elementText("path").trim())));
	return new MappingNode(Tag.MAP, tuples, FlowStyle.BLOCK);
}
 
Example 5
Source File: YamlOrderedSkipEmptyRepresenter.java    From flow-platform-x with Apache License 2.0 5 votes vote down vote up
@Override
protected MappingNode representJavaBean(Set<Property> properties, Object javaBean) {
    List<NodeTuple> value = new ArrayList<>(properties.size());
    Tag tag;
    Tag customTag = classTags.get(javaBean.getClass());
    tag = customTag != null ? customTag : new Tag(javaBean.getClass());
    MappingNode node = new MappingNode(tag, value, FlowStyle.BLOCK);
    representedObjects.put(javaBean, node);

    List<Property> orderProperties = new ArrayList<>(properties);
    orderProperties.sort(sorter);

    for (Property property : orderProperties) {
        Object memberValue = property.get(javaBean);
        Tag customPropertyTag = memberValue == null ? null
            : classTags.get(memberValue.getClass());
        NodeTuple tuple = representJavaBeanProperty(javaBean, property, memberValue,
            customPropertyTag);
        if (tuple == null) {
            continue;
        }

        value.add(tuple);
    }

    return node;
}
 
Example 6
Source File: BuildSpec.java    From onedev with MIT License 5 votes vote down vote up
@SuppressWarnings("unused")
private void migrate1(VersionedYamlDoc doc, Stack<Integer> versions) {
	for (NodeTuple specTuple: doc.getValue()) {
		if (((ScalarNode)specTuple.getKeyNode()).getValue().equals("jobs")) {
			SequenceNode jobsNode = (SequenceNode) specTuple.getValueNode();
			for (Node jobsNodeItem: jobsNode.getValue()) {
				MappingNode jobNode = (MappingNode) jobsNodeItem;
				for (Iterator<NodeTuple> itJobTuple = jobNode.getValue().iterator(); itJobTuple.hasNext();) {
					NodeTuple jobTuple = itJobTuple.next();
					String jobTupleKey = ((ScalarNode)jobTuple.getKeyNode()).getValue();
					if (jobTupleKey.equals("submoduleCredentials")) {
						itJobTuple.remove();
					} else if (jobTupleKey.equals("projectDependencies")) {
						SequenceNode projectDependenciesNode = (SequenceNode) jobTuple.getValueNode();
						for (Node projectDependenciesItem: projectDependenciesNode.getValue()) {
							MappingNode projectDependencyNode = (MappingNode) projectDependenciesItem;
							for (Iterator<NodeTuple> itProjectDependencyTuple = projectDependencyNode.getValue().iterator(); 
									itProjectDependencyTuple.hasNext();) {
								NodeTuple projectDependencyTuple = itProjectDependencyTuple.next();
								if (((ScalarNode)projectDependencyTuple.getKeyNode()).getValue().equals("authentication"))
									itProjectDependencyTuple.remove();
							}								
						}
					}
				}
				NodeTuple cloneCredentialTuple = new NodeTuple(
						new ScalarNode(Tag.STR, "cloneCredential"), 
						new MappingNode(new Tag("!DefaultCredential"), Lists.newArrayList(), FlowStyle.BLOCK));
				jobNode.getValue().add(cloneCredentialTuple);
			}
		}
	}
}
 
Example 7
Source File: XmlBuildSpecMigrator.java    From onedev with MIT License 5 votes vote down vote up
private static Node migrateProjectDependency(Element projectDependencyElement) {
	List<NodeTuple> tuples = new ArrayList<>();
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "projectName"), 
			new ScalarNode(Tag.STR, projectDependencyElement.elementText("projectName").trim())));
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "buildNumber"), 
			new ScalarNode(Tag.STR, projectDependencyElement.elementText("buildNumber").trim())));
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "artifacts"), 
			new ScalarNode(Tag.STR, projectDependencyElement.elementText("artifacts").trim())));

	Element authenticationElement = projectDependencyElement.element("authentication");
	if (authenticationElement != null) {
		List<NodeTuple> authenticationTuples = new ArrayList<>();
		authenticationTuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "userName"), 
				new ScalarNode(Tag.STR, authenticationElement.elementText("userName").trim())));
		authenticationTuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "passwordSecret"), 
				new ScalarNode(Tag.STR, authenticationElement.elementText("passwordSecret").trim())));
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "authentication"), 
				new MappingNode(Tag.MAP, authenticationTuples, FlowStyle.BLOCK)));
	}
	return new MappingNode(Tag.MAP, tuples, FlowStyle.BLOCK);
}
 
Example 8
Source File: XmlBuildSpecMigrator.java    From onedev with MIT License 5 votes vote down vote up
private static Node migrateReport(Element reportElement) {
	List<NodeTuple> tuples = new ArrayList<>();
	String classTag = getClassTag(reportElement.getName());
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "filePatterns"), 
			new ScalarNode(Tag.STR, reportElement.elementText("filePatterns").trim())));
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "reportName"), 
			new ScalarNode(Tag.STR, reportElement.elementText("reportName").trim())));
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "startPage"), 
			new ScalarNode(Tag.STR, reportElement.elementText("startPage").trim())));
	return new MappingNode(new Tag(classTag), tuples, FlowStyle.BLOCK);
}
 
Example 9
Source File: XmlBuildSpecMigrator.java    From onedev with MIT License 5 votes vote down vote up
private static Node migrateTrigger(Element triggerElement) {
	List<NodeTuple> tuples = new ArrayList<>();
	String classTag = getClassTag(triggerElement.getName());

	List<Node> paramSupplyNodes = migrateParamSupplies(triggerElement.element("params").elements());
	if (!paramSupplyNodes.isEmpty()) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "params"), 
				new SequenceNode(Tag.SEQ, paramSupplyNodes, FlowStyle.BLOCK)));
	}
	
	Element branchesElement = triggerElement.element("branches");
	if (branchesElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "branches"), 
				new ScalarNode(Tag.STR, branchesElement.getText().trim())));
	}
	
	Element pathsElement = triggerElement.element("paths");
	if (pathsElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "paths"), 
				new ScalarNode(Tag.STR, pathsElement.getText().trim())));
	}
	
	Element tagsElement = triggerElement.element("tags");
	if (tagsElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "tags"), 
				new ScalarNode(Tag.STR, tagsElement.getText().trim())));
	}
	
	return new MappingNode(new Tag(classTag), tuples, FlowStyle.BLOCK);
}
 
Example 10
Source File: YamlOrderedSkipEmptyRepresenter.java    From flow-platform-x with Apache License 2.0 5 votes vote down vote up
@Override
protected MappingNode representJavaBean(Set<Property> properties, Object javaBean) {
    List<NodeTuple> value = new ArrayList<>(properties.size());
    Tag tag;
    Tag customTag = classTags.get(javaBean.getClass());
    tag = customTag != null ? customTag : new Tag(javaBean.getClass());
    MappingNode node = new MappingNode(tag, value, FlowStyle.BLOCK);
    representedObjects.put(javaBean, node);

    List<Property> orderProperties = new ArrayList<>(properties);
    orderProperties.sort(sorter);

    for (Property property : orderProperties) {
        Object memberValue = property.get(javaBean);
        Tag customPropertyTag = memberValue == null ? null
            : classTags.get(memberValue.getClass());
        NodeTuple tuple = representJavaBeanProperty(javaBean, property, memberValue,
            customPropertyTag);
        if (tuple == null) {
            continue;
        }

        value.add(tuple);
    }

    return node;
}
 
Example 11
Source File: XmlBuildSpecMigrator.java    From onedev with MIT License 5 votes vote down vote up
private static Node migrateValueMatcher(Element valueMatcherElement) {
	List<NodeTuple> tuples = new ArrayList<>();
	String classTag = getClassTag(valueMatcherElement.attributeValue("class"));
	Element valuesElement = valueMatcherElement.element("values");
	if (valuesElement != null) {
		List<Node> valueNodes = new ArrayList<>();
		for (Element valueElement: valuesElement.elements()) 
			valueNodes.add(new ScalarNode(Tag.STR, valueElement.getText().trim()));
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "values"), 
				new SequenceNode(Tag.SEQ, valueNodes, FlowStyle.BLOCK)));
	}
	
	return new MappingNode(new Tag(classTag), tuples, FlowStyle.BLOCK);
}
 
Example 12
Source File: XmlBuildSpecMigrator.java    From onedev with MIT License 5 votes vote down vote up
private static Node migrateShowCondition(Element showConditionElement) {
	List<NodeTuple> tuples = new ArrayList<>();
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "inputName"), 
			new ScalarNode(Tag.STR, showConditionElement.elementText("inputName").trim())));
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "valueMatcher"), 
			migrateValueMatcher(showConditionElement.element("valueMatcher"))));
	return new MappingNode(Tag.MAP, tuples, FlowStyle.BLOCK);
}
 
Example 13
Source File: XmlBuildSpecMigrator.java    From onedev with MIT License 5 votes vote down vote up
private static Node migrateChoiceProvider(Element choiceProviderElement) {
	List<NodeTuple> tuples = new ArrayList<>();
	String classTag = getClassTag(choiceProviderElement.attributeValue("class"));

	Element scriptNameElement = choiceProviderElement.element("scriptName");
	if (scriptNameElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "scriptName"), 
				new ScalarNode(Tag.STR, scriptNameElement.getText().trim())));
	}
	Element choicesElement = choiceProviderElement.element("choices");
	if (choicesElement != null) {
		List<Node> choiceNodes = new ArrayList<>();
		for (Element choiceElement: choicesElement.elements()) {
			List<NodeTuple> choiceTuples = new ArrayList<>();
			choiceTuples.add(new NodeTuple(
					new ScalarNode(Tag.STR, "value"), 
					new ScalarNode(Tag.STR, choiceElement.elementText("value").trim())));
			choiceTuples.add(new NodeTuple(
					new ScalarNode(Tag.STR, "color"), 
					new ScalarNode(Tag.STR, choiceElement.elementText("color").trim())));
			choiceNodes.add(new MappingNode(Tag.MAP, choiceTuples, FlowStyle.BLOCK));
		}
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "choices"), 
				new SequenceNode(Tag.SEQ, choiceNodes, FlowStyle.BLOCK)));
	}
	
	return new MappingNode(new Tag(classTag), tuples, FlowStyle.BLOCK);
}
 
Example 14
Source File: Representer.java    From onedev with MIT License 5 votes vote down vote up
/**
 * Tag logic:
 * - explicit root tag is set in serializer
 * - if there is a predefined class tag it is used
 * - a global tag with class name is always used as tag. The JavaBean parent
 * of the specified JavaBean may set another tag (tag:yaml.org,2002:map)
 * when the property class is the same as runtime class
 *
 * @param properties
 *            JavaBean getters
 * @param javaBean
 *            instance for Node
 * @return Node to get serialized
 */
protected MappingNode representJavaBean(Set<Property> properties, Object javaBean) {
    List<NodeTuple> value = new ArrayList<NodeTuple>(properties.size());
    Tag tag;
    Tag customTag = classTags.get(javaBean.getClass());
    tag = customTag != null ? customTag : new Tag("!" + javaBean.getClass().getSimpleName());
    // flow style will be chosen by BaseRepresenter
    MappingNode node = new MappingNode(tag, value, FlowStyle.AUTO);
    representedObjects.put(javaBean, node);
    DumperOptions.FlowStyle bestStyle = FlowStyle.FLOW;
    for (Property property : properties) {
        Object memberValue = property.get(javaBean);
        Tag customPropertyTag = memberValue == null ? null
                : classTags.get(memberValue.getClass());
        NodeTuple tuple = representJavaBeanProperty(javaBean, property, memberValue,
                customPropertyTag);
        if (tuple == null) {
            continue;
        }
        if (!((ScalarNode) tuple.getKeyNode()).isPlain()) {
            bestStyle = FlowStyle.BLOCK;
        }
        Node nodeValue = tuple.getValueNode();
        if (!(nodeValue instanceof ScalarNode && ((ScalarNode) nodeValue).isPlain())) {
            bestStyle = FlowStyle.BLOCK;
        }
        value.add(tuple);
    }
    if (defaultFlowStyle != FlowStyle.AUTO) {
        node.setFlowStyle(defaultFlowStyle);
    } else {
        node.setFlowStyle(bestStyle);
    }
    return node;
}
 
Example 15
Source File: XmlBuildSpecMigrator.java    From onedev with MIT License 4 votes vote down vote up
private static Node migratePostBuildAction(Element postBuildActionElement) {
	List<NodeTuple> tuples = new ArrayList<>();
	String classTag = getClassTag(postBuildActionElement.getName());
	
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "condition"), 
			new ScalarNode(Tag.STR, postBuildActionElement.elementText("condition").trim())));
	
	Element milestoneNameElement = postBuildActionElement.element("milestoneName");
	if (milestoneNameElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "milestoneName"), 
				new ScalarNode(Tag.STR, milestoneNameElement.getText().trim())));
	}
	
	Element issueTitleElement = postBuildActionElement.element("issueTitle");
	if (issueTitleElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "issueTitle"), 
				new ScalarNode(Tag.STR, issueTitleElement.getText().trim())));
	}
	
	Element issueDescriptionElement = postBuildActionElement.element("issueDescription");
	if (issueDescriptionElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "issueDescription"), 
				new ScalarNode(Tag.STR, issueDescriptionElement.getText().trim())));
	}
	
	Element issueFieldsElement = postBuildActionElement.element("issueFields");
	if (issueFieldsElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "issueFields"), 
				new SequenceNode(Tag.SEQ, migrateFieldSupplies(issueFieldsElement.elements()), FlowStyle.BLOCK)));
	}
	
	Element tagNameElement = postBuildActionElement.element("tagName");
	if (tagNameElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "tagName"), 
				new ScalarNode(Tag.STR, tagNameElement.getText().trim())));
	}
	
	Element tagMessageElement = postBuildActionElement.element("tagMessage");
	if (tagMessageElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "tagMessage"), 
				new ScalarNode(Tag.STR, tagMessageElement.getText().trim())));
	}
	
	Element jobNameElement = postBuildActionElement.element("jobName");
	if (jobNameElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "jobName"), 
				new ScalarNode(Tag.STR, jobNameElement.getText().trim())));
	}
	
	Element jobParamsElement = postBuildActionElement.element("jobParams");
	if (jobParamsElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "jobParams"), 
				new SequenceNode(Tag.SEQ, migrateParamSupplies(jobParamsElement.elements()), FlowStyle.BLOCK)));
	}
	
	Element receiversElement = postBuildActionElement.element("receivers");
	if (receiversElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "receivers"), 
				new ScalarNode(Tag.STR, receiversElement.getText().trim())));
	}
	
	return new MappingNode(new Tag(classTag), tuples, FlowStyle.BLOCK);
}
 
Example 16
Source File: XmlBuildSpecMigrator.java    From onedev with MIT License 4 votes vote down vote up
private static Node migrateService(Element serviceElement) {
	List<NodeTuple> tuples = new ArrayList<>();

	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "name"), 
			new ScalarNode(Tag.STR, serviceElement.elementText("name").trim())));
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "image"), 
			new ScalarNode(Tag.STR, serviceElement.elementText("image").trim())));
	Element argumentsElement = serviceElement.element("arguments");
	if (argumentsElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "arguments"), 
				new ScalarNode(Tag.STR, argumentsElement.getText().trim())));
	}
	List<Node> envVarNodes = new ArrayList<>();
	for (Element envVarElement: serviceElement.element("envVars").elements()) {
		List<NodeTuple> envVarTuples = new ArrayList<>();
		envVarTuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "name"),
				new ScalarNode(Tag.STR, envVarElement.elementText("name").trim())));
		envVarTuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "value"),
				new ScalarNode(Tag.STR, envVarElement.elementText("value").trim())));
		envVarNodes.add(new MappingNode(Tag.MAP, envVarTuples, FlowStyle.BLOCK));
	}
	if (!envVarNodes.isEmpty()) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "envVars"), 
				new SequenceNode(Tag.SEQ, envVarNodes, FlowStyle.BLOCK)));
	}
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "readinessCheckCommand"), 
			new ScalarNode(Tag.STR, serviceElement.elementText("readinessCheckCommand").trim())));
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "cpuRequirement"), 
			new ScalarNode(Tag.STR, serviceElement.elementText("cpuRequirement").trim())));
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "memoryRequirement"), 
			new ScalarNode(Tag.STR, serviceElement.elementText("memoryRequirement").trim())));
	
	return new MappingNode(Tag.MAP, tuples, FlowStyle.BLOCK);
}
 
Example 17
Source File: XmlBuildSpecMigrator.java    From onedev with MIT License 4 votes vote down vote up
private static Node migrateParamSpec(Element paramSpecElement) {
	String classTag = getClassTag(paramSpecElement.getName());
	List<NodeTuple> tuples = new ArrayList<>();
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "name"), 
			new ScalarNode(Tag.STR, paramSpecElement.elementText("name").trim())));
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "allowEmpty"), 
			new ScalarNode(Tag.STR, paramSpecElement.elementText("allowEmpty").trim())));
	tuples.add(new NodeTuple(
			new ScalarNode(Tag.STR, "allowMultiple"), 
			new ScalarNode(Tag.STR, paramSpecElement.elementText("allowMultiple").trim())));
	Element patternElement = paramSpecElement.element("pattern");
	if (patternElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "pattern"), 
				new ScalarNode(Tag.STR, patternElement.getText().trim())));
	}
	Element descriptionElement = paramSpecElement.element("description");
	if (descriptionElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "description"), 
				new ScalarNode(Tag.STR, descriptionElement.getText().trim())));
	}
	Element minValueElement = paramSpecElement.element("minValue");
	if (minValueElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "minValue"), 
				new ScalarNode(Tag.STR, minValueElement.getText().trim())));
	}
	Element maxValueElement = paramSpecElement.element("maxValue");
	if (maxValueElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "maxValue"), 
				new ScalarNode(Tag.STR, maxValueElement.getText().trim())));
	}
	Element showConditionElement = paramSpecElement.element("showCondition");
	if (showConditionElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "showCondition"), 
				migrateShowCondition(showConditionElement)));
	}
	Element defaultValueProviderElement = paramSpecElement.element("defaultValueProvider");
	if (defaultValueProviderElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "defaultValueProvider"), 
				migrateDefaultValueProvider(defaultValueProviderElement)));
	}
	Element defaultMultiValueProviderElement = paramSpecElement.element("defaultMultiValueProvider");
	if (defaultMultiValueProviderElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "defaultMultiValueProvider"), 
				migrateDefaultMultiValueProvider(defaultMultiValueProviderElement)));
	}
	Element choiceProviderElement = paramSpecElement.element("choiceProvider");
	if (choiceProviderElement != null) {
		tuples.add(new NodeTuple(
				new ScalarNode(Tag.STR, "choiceProvider"), 
				migrateChoiceProvider(choiceProviderElement)));
	}
	return new MappingNode(new Tag(classTag), tuples, FlowStyle.BLOCK);
}
 
Example 18
Source File: JavaBeanDumper.java    From orion.server with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Create Dumper for JavaBeans
 * 
 * @param useGlobalTag
 *            true to emit the global tag with the class name
 */
public JavaBeanDumper(boolean useGlobalTag, BeanAccess beanAccess) {
    this.useGlobalTag = useGlobalTag;
    this.beanAccess = beanAccess;
    this.flowStyle = FlowStyle.BLOCK;
}