本文整理了Java中org.yaml.snakeyaml.nodes.Tag.<init>()
方法的一些代码示例,展示了Tag.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tag.<init>()
方法的具体详情如下:
包路径:org.yaml.snakeyaml.nodes.Tag
类名称:Tag
方法名:<init>
暂无
代码示例来源:origin: redisson/redisson
public TypeDescription(Class<? extends Object> clazz, String tag) {
this(clazz, new Tag(tag), null);
}
代码示例来源:origin: redisson/redisson
public void setTag(String tag) {
setTag(new Tag(tag));
}
代码示例来源:origin: redisson/redisson
public Node representData(Object data) {
Tag tag = new Tag(data.getClass());
return representScalar(getTag(data.getClass(), tag), ((Enum<?>) data).name());
}
}
代码示例来源:origin: redisson/redisson
public Node representData(Object data) {
return representScalar(getTag(data.getClass(), new Tag(UUID.class)), data.toString());
}
}
代码示例来源:origin: redisson/redisson
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);
}
}
}
代码示例来源:origin: redisson/redisson
Tag tag;
Tag customTag = classTags.get(javaBean.getClass());
tag = customTag != null ? customTag : new Tag(javaBean.getClass());
代码示例来源: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
protected Node composeMappingNode(String anchor) {
MappingStartEvent startEvent = (MappingStartEvent) parser.getEvent();
String tag = startEvent.getTag();
Tag nodeTag;
boolean resolved = false;
if (tag == null || tag.equals("!")) {
nodeTag = resolver.resolve(NodeId.mapping, null, startEvent.getImplicit());
resolved = true;
} else {
nodeTag = new Tag(tag);
}
final List<NodeTuple> children = new ArrayList<NodeTuple>();
MappingNode node = new MappingNode(nodeTag, resolved, children, startEvent.getStartMark(),
null, startEvent.getFlowStyle());
if (anchor != null) {
anchors.put(anchor, node);
}
while (!parser.checkEvent(Event.ID.MappingEnd)) {
composeMappingChildren(children, node);
}
Event endEvent = parser.getEvent();
node.setEndMark(endEvent.getEndMark());
return node;
}
代码示例来源:origin: redisson/redisson
/**
* Ensure that the stream contains a single document and construct it
*
* @param type the class of the instance being created
* @return constructed instance
* @throws ComposerException in case there are more documents in the stream
*/
public Object getSingleData(Class<?> type) {
// Ensure that the stream contains a single document and construct it
Node node = composer.getSingleNode();
if (node != null && !Tag.NULL.equals(node.getTag())) {
if (Object.class != type) {
node.setTag(new Tag(type));
} else if (rootTag != null) {
node.setTag(rootTag);
}
return constructDocument(node);
}
return null;
}
代码示例来源: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: gov.nasa.jpl.imce/gov.nasa.jpl.magicdraw.projectUsageIntegrityChecker
@Override
public Node representData(Object data) {
if (!(data instanceof URI))
throw new IllegalArgumentException("URIRepresenter -- data should be a URI");
URI uri = (URI) data;
String value = uri.toString();
return representScalar(new Tag("!emf.URI"), value);
}
代码示例来源:origin: gov.nasa.jpl.imce/gov.nasa.jpl.magicdraw.projectUsageIntegrityChecker
@Override
public Node representData(Object data) {
if (!(data instanceof ProjectClassification))
throw new IllegalArgumentException("ProjectClassificationRepresenter -- data should be a ProjectClassification");
ProjectClassification pc = (ProjectClassification) data;
String value = pc.name();
return representScalar(new Tag("!SSCAE.Classification"), value);
}
代码示例来源:origin: torquebox/jruby-maven-plugins
public MappingConstructor() {
super();
this.addTypeDescription(new TypeDescription(GemSpecification.class,
new Tag("!ruby/object:Gem::Specification")));
this.addTypeDescription(new TypeDescription(GemDependency.class,
new Tag("!ruby/object:Gem::Dependency")));
this.addTypeDescription(new TypeDescription(GemRequirement.class,
new Tag("!ruby/object:Gem::Requirement")));
this.addTypeDescription(new TypeDescription(GemVersion.class,
new Tag("!ruby/object:Gem::Version")));
}
}
代码示例来源:origin: sberan/Fixy
public CoreFixy(Persister persister, String defaultPackage, BeanAccess beanAccess) {
this.yamlConstructors.put(new Tag("!import"), new ConstructImport(this));
this.yamlConstructors.put(new Tag("!package"), new ConstructPackage(this));
this.defaultPackage = defaultPackage;
this.packageName = defaultPackage;
this.persister = persister;
this.beanAccess = beanAccess;
}
代码示例来源:origin: info.magnolia.core/magnolia-configuration
void registerConstruct(String tag, Construct construct) {
if (construct instanceof MgnlYamlConstruct) {
((MgnlYamlConstruct) construct).setConstructor(this);
}
yamlConstructors.put(new Tag(tag), construct);
}
代码示例来源:origin: pl.droidsonroids.yaml/snakeyaml
public Node representData(Object data) {
Tag tag = new Tag(data.getClass());
return representScalar(getTag(data.getClass(), tag), ((Enum<?>) data).name());
}
}
代码示例来源:origin: info.magnolia/magnolia-core
private JcrPropertySupportingConstructor(ValueFactory valueFactory) {
yamlConstructors.put(new Tag("!" + StringUtils.lowerCase(PropertyType.TYPENAME_PATH)), new JcrConstruct(PropertyType.PATH, valueFactory));
yamlConstructors.put(new Tag("!" + StringUtils.lowerCase(PropertyType.TYPENAME_URI)), new JcrConstruct(PropertyType.URI, valueFactory));
yamlConstructors.put(new Tag("!" + StringUtils.lowerCase(PropertyType.TYPENAME_REFERENCE)), new JcrConstruct(PropertyType.REFERENCE, valueFactory));
yamlConstructors.put(new Tag("!" + StringUtils.lowerCase(PropertyType.TYPENAME_WEAKREFERENCE)), new JcrConstruct(PropertyType.WEAKREFERENCE, valueFactory));
yamlConstructors.put(new Tag("!" + StringUtils.lowerCase(PropertyType.TYPENAME_BINARY)), new JcrConstruct(PropertyType.BINARY, valueFactory));
}
}
代码示例来源:origin: de.digitalcollections.commons/dc-commons-yaml
public JodaTimeRepresenter() {
multiRepresenters.put(DateTime.class, data -> {
DateTime date = (DateTime) data;
return super.representData(new Date(date.getMillis()));
});
multiRepresenters.put(LocalDateTime.class, data -> {
LocalDateTime date = (LocalDateTime) data;
return super.representScalar(new Tag("!localTimestamp"), date.toString());
});
}
代码示例来源:origin: com.airbnb.walkman/walkman
@Override public Node representData(Object data) {
RecordedResponse recordedResponse = (RecordedResponse) data;
Tag tag = getTag(RecordedResponse.class, new Tag(RecordedResponse.class));
return representSequence(tag, Arrays.asList(recordedResponse.code(), recordedResponse
.headers(), recordedResponse.getBody()), true);
}
}
代码示例来源:origin: com.airbnb.walkman/walkman
@Override public Node representData(Object data) {
RecordedRequest recordedRequest = (RecordedRequest) data;
Tag tag = getTag(RecordedRequest.class, new Tag(RecordedRequest.class));
return representSequence(tag, Arrays.asList(recordedRequest.method(), recordedRequest.url()
.toString(), recordedRequest.headers(), recordedRequest.getBody()), true);
}
}
内容来源于网络,如有侵权,请联系作者删除!