本文整理汇总了Java中org.yaml.snakeyaml.nodes.SequenceNode.setFlowStyle方法的典型用法代码示例。如果您正苦于以下问题:Java SequenceNode.setFlowStyle方法的具体用法?Java SequenceNode.setFlowStyle怎么用?Java SequenceNode.setFlowStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.yaml.snakeyaml.nodes.SequenceNode
的用法示例。
在下文中一共展示了SequenceNode.setFlowStyle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: representSequence
import org.yaml.snakeyaml.nodes.SequenceNode; //导入方法依赖的package包/类
protected Node representSequence(Tag tag, Iterable<?> sequence, Boolean flowStyle) {
int size = 10;// default for ArrayList
if (sequence instanceof List<?>) {
size = ((List<?>) sequence).size();
}
List<Node> value = new ArrayList<Node>(size);
SequenceNode node = new SequenceNode(tag, value, flowStyle);
representedObjects.put(objectToRepresent, node);
boolean bestStyle = true;
for (Object item : sequence) {
Node nodeItem = representData(item);
if (!(nodeItem instanceof ScalarNode && ((ScalarNode) nodeItem).getStyle() == null)) {
bestStyle = false;
}
value.add(nodeItem);
}
if (flowStyle == null) {
if (defaultFlowStyle != FlowStyle.AUTO) {
node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
} else {
node.setFlowStyle(bestStyle);
}
}
return node;
}
示例2: representSequence
import org.yaml.snakeyaml.nodes.SequenceNode; //导入方法依赖的package包/类
protected Node representSequence(Tag tag, Iterable<? extends Object> sequence, Boolean flowStyle) {
int size = 10;// default for ArrayList
if (sequence instanceof List<?>) {
size = ((List<?>) sequence).size();
}
List<Node> value = new ArrayList<Node>(size);
SequenceNode node = new SequenceNode(tag, value, flowStyle);
representedObjects.put(objectToRepresent, node);
boolean bestStyle = true;
for (Object item : sequence) {
Node nodeItem = representData(item);
if (!((nodeItem instanceof ScalarNode && ((ScalarNode) nodeItem).getStyle() == null))) {
bestStyle = false;
}
value.add(nodeItem);
}
if (flowStyle == null) {
if (defaultFlowStyle != FlowStyle.AUTO) {
node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
} else {
node.setFlowStyle(bestStyle);
}
}
return node;
}
示例3: representSequence
import org.yaml.snakeyaml.nodes.SequenceNode; //导入方法依赖的package包/类
protected Node representSequence(final Tag tag, final Iterable<?> sequence, final Boolean flowStyle) {
int size = 10;// default for ArrayList
if (sequence instanceof List<?>) {
size = ((List<?>) sequence).size();
}
List<Node> value = new ArrayList<Node>(size);
SequenceNode node = new SequenceNode(tag, value, flowStyle);
representedObjects.put(objectToRepresent, node);
boolean bestStyle = true;
for (Object item : sequence) {
Node nodeItem = representData(item);
if (!((nodeItem instanceof ScalarNode && ((ScalarNode) nodeItem).getStyle() == null))) {
bestStyle = false;
}
value.add(nodeItem);
}
if (flowStyle == null) {
if (defaultFlowStyle != FlowStyle.AUTO) {
node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
} else {
node.setFlowStyle(bestStyle);
}
}
return node;
}
示例4: representSequence
import org.yaml.snakeyaml.nodes.SequenceNode; //导入方法依赖的package包/类
@Override
public Node representSequence(Tag tag, Iterable<?> sequence, @Nullable Boolean flowStyle)
{
int size = 10;// default for ArrayList
if (sequence instanceof Collection<?>)
{
size = ((Collection<?>) sequence).size();
}
List<Node> value = new ArrayList<>(size);
SequenceNode node = new SequenceNode(tag, value, flowStyle);
this.representedObjects.put(this.objectToRepresent, node);
boolean bestStyle = true;
long width = 0;
for (Object item : sequence)
{
Node nodeItem = this.representData(item);
if (bestStyle)
{
if ((nodeItem instanceof ScalarNode) && (((ScalarNode) nodeItem).getStyle() == null))
{
String val = ((ScalarNode) nodeItem).getValue();
width += (val == null) ? 0 : val.length();
width += 2; // comma and space.
if (width > MAX_WIDTH)
{
bestStyle = false;
}
}
else
{
bestStyle = false;
}
}
value.add(nodeItem);
}
if (flowStyle == null)
{
// we ignore this for diorite representer, configs should look nice.
// if (this.defaultFlowStyle != FlowStyle.AUTO)
// {
// node.setFlowStyle(this.defaultFlowStyle.getStyleBoolean());
// }
// else
// {
node.setFlowStyle(bestStyle);
// }
}
return node;
}