本文整理了Java中org.yaml.snakeyaml.constructor.Constructor.getConstructor()
方法的一些代码示例,展示了Constructor.getConstructor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Constructor.getConstructor()
方法的具体详情如下:
包路径:org.yaml.snakeyaml.constructor.Constructor
类名称:Constructor
方法名:getConstructor
暂无
代码示例来源:origin: redisson/redisson
@Override
protected Construct getConstructor(Node node) {
if (node instanceof MappingNode) {
MappingNode mnode = (MappingNode) node;
List<NodeTuple> list = mnode.getValue();
if (list.size() == 1) {
NodeTuple tuple = list.get(0);
Node key = tuple.getKeyNode();
if (key instanceof ScalarNode) {
ScalarNode scalar = (ScalarNode) key;
if (GUESS_COMPACT.matcher(scalar.getValue()).matches()) {
return getCompactConstruct();
}
}
}
} else if (node instanceof ScalarNode) {
ScalarNode scalar = (ScalarNode) node;
if (GUESS_COMPACT.matcher(scalar.getValue()).matches()) {
return getCompactConstruct();
}
}
return super.getConstructor(node);
}
代码示例来源:origin: takari/polyglot-maven
@Override
protected Construct getConstructor(Node node) {
if (pomConstructors.containsKey(node.getType()) && node instanceof ScalarNode) {
//construct compact form from scalar
return pomConstructors.get(node.getType());
} else {
return super.getConstructor(node);
}
}
代码示例来源:origin: io.takari.polyglot/polyglot-yaml
@Override
protected Construct getConstructor(Node node) {
if (pomConstructors.containsKey(node.getType()) && node instanceof ScalarNode) {
//construct compact form from scalar
return pomConstructors.get(node.getType());
} else {
return super.getConstructor(node);
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
@Override
protected Construct getConstructor(Node node) {
if (node instanceof MappingNode) {
MappingNode mnode = (MappingNode) node;
List<NodeTuple> list = mnode.getValue();
if (list.size() == 1) {
NodeTuple tuple = list.get(0);
Node key = tuple.getKeyNode();
if (key instanceof ScalarNode) {
ScalarNode scalar = (ScalarNode) key;
if (GUESS_COMPACT.matcher(scalar.getValue()).matches()) {
return getCompactConstruct();
}
}
}
} else if (node instanceof ScalarNode) {
ScalarNode scalar = (ScalarNode) node;
if (GUESS_COMPACT.matcher(scalar.getValue()).matches()) {
return getCompactConstruct();
}
}
return super.getConstructor(node);
}
代码示例来源:origin: pl.droidsonroids.yaml/snakeyaml
@Override
protected Construct getConstructor(Node node) {
if (node instanceof MappingNode) {
MappingNode mnode = (MappingNode) node;
List<NodeTuple> list = mnode.getValue();
if (list.size() == 1) {
NodeTuple tuple = list.get(0);
Node key = tuple.getKeyNode();
if (key instanceof ScalarNode) {
ScalarNode scalar = (ScalarNode) key;
if (GUESS_COMPACT.matcher(scalar.getValue()).matches()) {
return getCompactConstruct();
}
}
}
} else if (node instanceof ScalarNode) {
ScalarNode scalar = (ScalarNode) node;
if (GUESS_COMPACT.matcher(scalar.getValue()).matches()) {
return getCompactConstruct();
}
}
return super.getConstructor(node);
}
代码示例来源:origin: harbby/presto-connectors
@Override
protected Construct getConstructor(Node node) {
if (node instanceof MappingNode) {
MappingNode mnode = (MappingNode) node;
List<NodeTuple> list = mnode.getValue();
if (list.size() == 1) {
NodeTuple tuple = list.get(0);
Node key = tuple.getKeyNode();
if (key instanceof ScalarNode) {
ScalarNode scalar = (ScalarNode) key;
if (GUESS_COMPACT.matcher(scalar.getValue()).matches()) {
return getCompactConstruct();
}
}
}
} else if (node instanceof ScalarNode) {
ScalarNode scalar = (ScalarNode) node;
if (GUESS_COMPACT.matcher(scalar.getValue()).matches()) {
return getCompactConstruct();
}
}
return super.getConstructor(node);
}
代码示例来源:origin: com.meltmedia.cadmium/cadmium-core
/**
* Overridden to fetch constructor even if tag is not mapped.
*/
@Override
protected Construct getConstructor(Node node) {
Construct construct = super.getConstructor(node);
logger.trace("getting constructor for node {} Tag {} = {}", new Object[] {node, node.getTag(), construct});
if(construct instanceof ConstructYamlObject && !tagsDefined.contains(node.getTag())) {
try {
node.getTag().getClassName();
} catch(YAMLException e) {
node.setUseClassConstructor(true);
String value = null;
if(node.getNodeId() == NodeId.scalar) {
value = ((ScalarNode)node).getValue();
}
node.setTag(resolver.resolve(node.getNodeId(), value, true));
construct = super.getConstructor(node);
try {
resolveType(node);
} catch (ClassNotFoundException e1) {
logger.debug("Could not find class.", e1);
}
}
}
logger.trace("returning constructor for node {} type {} Tag {} = {}", new Object[] {node, node.getType(), node.getTag(), construct});
return construct;
}
内容来源于网络,如有侵权,请联系作者删除!