本文整理了Java中org.yaml.snakeyaml.resolver.Resolver
类的一些代码示例,展示了Resolver
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resolver
类的具体详情如下:
包路径:org.yaml.snakeyaml.resolver.Resolver
类名称:Resolver
[英]Resolver tries to detect a type by content (when the tag is implicit)
[中]解析程序尝试按内容检测类型(当标记是隐式的时)
代码示例来源:origin: embulk/embulk
@Override
public Tag resolve(NodeId kind, String value, boolean implicit) {
return super.resolve(kind, value, implicit); // checks implicit resolvers
}
}
代码示例来源:origin: redisson/redisson
/**
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*
* @param constructor
* BaseConstructor to construct incoming documents
* @param representer
* Representer to emit outgoing objects
* @param dumperOptions
* DumperOptions to configure outgoing objects
* @param loadingConfig
* LoadingConfig to control load behavior
*/
public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions,
LoaderOptions loadingConfig) {
this(constructor, representer, dumperOptions, loadingConfig, new Resolver());
}
代码示例来源:origin: redisson/redisson
/**
* Add an implicit scalar detector. If an implicit scalar value matches the
* given regexp, the corresponding tag is assigned to the scalar.
*
* @param tag
* tag to assign to the node
* @param regexp
* regular expression to match against
* @param first
* a sequence of possible initial characters or null (which means
* any).
*/
public void addImplicitResolver(Tag tag, Pattern regexp, String first) {
resolver.addImplicitResolver(tag, regexp, first);
}
代码示例来源:origin: redisson/redisson
public Resolver() {
addImplicitResolvers();
}
代码示例来源:origin: pl.droidsonroids.yaml/snakeyaml
public Resolver() {
addImplicitResolvers();
}
代码示例来源:origin: redisson/redisson
Tag nodeTag = _yamlResolver.resolve(NodeId.scalar, value, scalar.getImplicit().canOmitTagInPlainScalar());
if (nodeTag == Tag.STR) {
return JsonToken.VALUE_STRING;
代码示例来源:origin: redisson/redisson
/**
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*
* @param constructor
* BaseConstructor to construct incoming documents
* @param representer
* Representer to emit outgoing objects
* @param dumperOptions
* DumperOptions to configure outgoing objects
*/
public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions) {
this(constructor, representer, dumperOptions, new LoaderOptions(), new Resolver());
}
代码示例来源:origin: redisson/redisson
protected void addImplicitResolvers() {
addImplicitResolver(Tag.BOOL, BOOL, "yYnNtTfFoO");
/*
* INT must be before FLOAT because the regular expression for FLOAT
* matches INT (see issue 130)
* http://code.google.com/p/snakeyaml/issues/detail?id=130
*/
addImplicitResolver(Tag.INT, INT, "-+0123456789");
addImplicitResolver(Tag.FLOAT, FLOAT, "-+0123456789.");
addImplicitResolver(Tag.MERGE, MERGE, "<");
addImplicitResolver(Tag.NULL, NULL, "~nN\0");
addImplicitResolver(Tag.NULL, EMPTY, null);
addImplicitResolver(Tag.TIMESTAMP, TIMESTAMP, "0123456789");
// The following implicit resolver is only for documentation
// purposes.
// It cannot work
// because plain scalars cannot start with '!', '&', or '*'.
addImplicitResolver(Tag.YAML, YAML, "!&*");
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
public Resolver() {
addImplicitResolvers();
}
代码示例来源:origin: redisson/redisson
protected Node composeSequenceNode(String anchor) {
SequenceStartEvent startEvent = (SequenceStartEvent) parser.getEvent();
String tag = startEvent.getTag();
Tag nodeTag;
boolean resolved = false;
if (tag == null || tag.equals("!")) {
nodeTag = resolver.resolve(NodeId.sequence, null, startEvent.getImplicit());
resolved = true;
} else {
nodeTag = new Tag(tag);
}
final ArrayList<Node> children = new ArrayList<Node>();
SequenceNode node = new SequenceNode(nodeTag, resolved, children, startEvent.getStartMark(),
null, startEvent.getFlowStyle());
if (anchor != null) {
anchors.put(anchor, node);
}
while (!parser.checkEvent(Event.ID.SequenceEnd)) {
children.add(composeNode(node));
}
Event endEvent = parser.getEvent();
node.setEndMark(endEvent.getEndMark());
return node;
}
代码示例来源:origin: redisson/redisson
/**
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*
* @param representer
* Representer to emit outgoing objects
* @param dumperOptions
* DumperOptions to configure outgoing objects
*/
public Yaml(Representer representer, DumperOptions dumperOptions) {
this(new Constructor(), representer, dumperOptions, new LoaderOptions(), new Resolver());
}
代码示例来源:origin: org.springframework.boot/spring-boot
@Override
public void addImplicitResolver(Tag tag, Pattern regexp, String first) {
if (tag == Tag.TIMESTAMP) {
return;
}
super.addImplicitResolver(tag, regexp, first);
}
代码示例来源:origin: harbby/presto-connectors
public Resolver() {
addImplicitResolvers();
}
代码示例来源:origin: com.fasterxml.jackson.dataformat/jackson-dataformat-yaml
Tag nodeTag = _yamlResolver.resolve(NodeId.scalar, value, scalar.getImplicit().canOmitTagInPlainScalar());
if (nodeTag == Tag.STR) {
return JsonToken.VALUE_STRING;
代码示例来源:origin: redisson/redisson
/**
* Create Yaml instance. It is safe to create a few instances and use them
* in different Threads.
*/
public Yaml() {
this(new Constructor(), new Representer(), new DumperOptions(), new LoaderOptions(),
new Resolver());
}
代码示例来源:origin: embulk/embulk
@Override
public void addImplicitResolver(Tag tag, Pattern regexp, String first) {
// This method is called by constructor through addImplicitResolvers
// to setup default implicit resolvers.
if (tag.equals(Tag.FLOAT)) {
super.addImplicitResolver(Tag.FLOAT, FLOAT_EXCEPTING_ZERO_START, "-+0123456789.");
} else if (tag.equals(Tag.BOOL)) {
// use stricter rule (reject 'On', 'Off', 'Yes', 'No')
super.addImplicitResolver(Tag.BOOL, Pattern.compile("^(?:[Tt]rue|[Ff]alse)$"), "TtFf");
} else if (tag.equals(Tag.TIMESTAMP)) {
// This solves some unexpected behavior that snakeyaml
// deserializes "2015-01-01 00:00:00" to java.util.Date
// but jackson serializes java.util.Date to an integer.
return;
} else {
super.addImplicitResolver(tag, regexp, first);
}
}
代码示例来源:origin: com.opentext.ia/infoarchive-yaml
@Override
protected void addImplicitResolvers() {
addImplicitResolver(Tag.STR, OFFSET_DATE_TIME, "0123456789");
super.addImplicitResolvers();
}
代码示例来源:origin: redisson/redisson
protected Node composeScalarNode(String anchor) {
ScalarEvent ev = (ScalarEvent) parser.getEvent();
String tag = ev.getTag();
boolean resolved = false;
Tag nodeTag;
if (tag == null || tag.equals("!")) {
nodeTag = resolver.resolve(NodeId.scalar, ev.getValue(),
ev.getImplicit().canOmitTagInPlainScalar());
resolved = true;
} else {
nodeTag = new Tag(tag);
}
Node node = new ScalarNode(nodeTag, resolved, ev.getValue(), ev.getStartMark(),
ev.getEndMark(), ev.getScalarStyle());
if (anchor != null) {
anchors.put(anchor, node);
}
return node;
}
代码示例来源:origin: stackoverflow.com
var Resolver = require('async-resolve');
var resolver_obj = new Resolver();
resolver_obj.resolve('module', __dirname, function(err, filename) {
return console.log(filename);
});
代码示例来源:origin: dyc87112/spring-cloud-config-admin
@Override
public void addImplicitResolver(Tag tag, Pattern regexp, String first) {
if (tag == Tag.TIMESTAMP) return;
super.addImplicitResolver(tag, regexp, first);
}
}
内容来源于网络,如有侵权,请联系作者删除!