本文整理了Java中com.google.api.tools.framework.yaml.YamlReaderHelper.error()
方法的一些代码示例,展示了YamlReaderHelper.error()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlReaderHelper.error()
方法的具体详情如下:
包路径:com.google.api.tools.framework.yaml.YamlReaderHelper
类名称:YamlReaderHelper
方法名:error
暂无
代码示例来源:origin: com.google.api/api-compiler
public void error(Mark mark, String message, Object... params) {
error(getLocation(mark), message, params);
}
代码示例来源:origin: com.google.api/api-compiler
public static String getStringValue(YamlReaderHelper config, Node node) {
if (!(node instanceof ScalarNode)) {
config.error(node, "Expected a scalar value.");
return null;
}
return ((ScalarNode) node).getValue();
}
代码示例来源:origin: com.google.api/api-compiler
public boolean checkAndAddPath(String path, Node value, FieldDescriptor field){
if (!traversedPaths.add(path)) {
error(value, "Node '%s' is already defined in this yaml file. Multiple definitions "
+ "for the same node are not allowed.", field.getFullName());
return false;
}
return true;
}
代码示例来源:origin: googleapis/api-compiler
public static String getStringValue(YamlReaderHelper config, Node node) {
if (!(node instanceof ScalarNode)) {
config.error(node, "Expected a scalar value.");
return null;
}
return ((ScalarNode) node).getValue();
}
代码示例来源:origin: googleapis/api-compiler
public boolean checkAndAddPath(String path, Node value, FieldDescriptor field){
if (!traversedPaths.add(path)) {
error(value, "Node '%s' is already defined in this yaml file. Multiple definitions "
+ "for the same node are not allowed.", field.getFullName());
return false;
}
return true;
}
代码示例来源:origin: googleapis/api-compiler
public void error(Mark mark, String message, Object... params) {
error(getLocation(mark), message, params);
}
代码示例来源:origin: googleapis/api-compiler
public void error(Node node, String message, Object... params) {
error(getLocation(node.getStartMark()), message, params);
}
代码示例来源:origin: com.google.api/api-compiler
public static Object convert(YamlReaderHelper config, FieldDescriptor field, Node node) {
String value = getStringValue(config, node);
try {
return node == null ? null : ProtoFieldValueParser.parseFieldFromString(field, value);
} catch (ParseException | UnsupportedTypeException e) {
config.error(node, "Parsing of field '%s' failed: %s", field.getName(), e.getMessage());
return null;
}
}
代码示例来源:origin: com.google.api/api-compiler
public void error(Node node, String message, Object... params) {
error(getLocation(node.getStartMark()), message, params);
}
代码示例来源:origin: googleapis/api-compiler
public static Object convert(YamlReaderHelper config, FieldDescriptor field, Node node) {
String value = getStringValue(config, node);
try {
return node == null ? null : ProtoFieldValueParser.parseFieldFromString(field, value);
} catch (ParseException | UnsupportedTypeException e) {
config.error(node, "Parsing of field '%s' failed: %s", field.getName(), e.getMessage());
return null;
}
}
代码示例来源:origin: com.google.api/api-compiler
public static MappingNode expectMap(YamlReaderHelper config, FieldDescriptor field, Node node) {
if (isEmpty(node)) {
return new MappingNode(Tag.OMAP, ImmutableList.<NodeTuple>of(), false);
} else if (node instanceof MappingNode) {
return (MappingNode) node;
} else {
config.error(node, "Expected a map to merge with '%s', found '%s'.",
field.getFullName(), node.getNodeId());
return new MappingNode(Tag.OMAP, ImmutableList.<NodeTuple>of(), false);
}
}
代码示例来源:origin: googleapis/api-compiler
public static MappingNode expectMap(YamlReaderHelper config, FieldDescriptor field, Node node) {
if (isEmpty(node)) {
return new MappingNode(Tag.OMAP, ImmutableList.<NodeTuple>of(), false);
} else if (node instanceof MappingNode) {
return (MappingNode) node;
} else {
config.error(node, "Expected a map to merge with '%s', found '%s'.",
field.getFullName(), node.getNodeId());
return new MappingNode(Tag.OMAP, ImmutableList.<NodeTuple>of(), false);
}
}
代码示例来源:origin: com.google.api/api-compiler
public static SequenceNode expectList(YamlReaderHelper config, FieldDescriptor field, Node node) {
if (isEmpty(node)) {
return new SequenceNode(Tag.SEQ, ImmutableList.<Node>of(), false);
} else if (node instanceof ScalarNode) {
// Allow a singleton as a list.
return new SequenceNode(Tag.SEQ, ImmutableList.<Node>of(node), false);
} else if (node instanceof SequenceNode) {
return (SequenceNode) node;
} else {
config.error(node, "Expected a list for field '%s', found '%s'.",
field.getFullName(), node.getNodeId());
return new SequenceNode(Tag.SEQ, ImmutableList.<Node>of(), false);
}
}
代码示例来源:origin: googleapis/api-compiler
public static SequenceNode expectList(YamlReaderHelper config, FieldDescriptor field, Node node) {
if (isEmpty(node)) {
return new SequenceNode(Tag.SEQ, ImmutableList.<Node>of(), false);
} else if (node instanceof ScalarNode) {
// Allow a singleton as a list.
return new SequenceNode(Tag.SEQ, ImmutableList.<Node>of(node), false);
} else if (node instanceof SequenceNode) {
return (SequenceNode) node;
} else {
config.error(node, "Expected a list for field '%s', found '%s'.",
field.getFullName(), node.getNodeId());
return new SequenceNode(Tag.SEQ, ImmutableList.<Node>of(), false);
}
}
代码示例来源:origin: googleapis/api-compiler
tree = YAML.compose(new StringReader(input));
} catch (ComposerException e) {
helper.error(e.getProblemMark(), "Parsing error: %s", e.getMessage());
return null;
} catch (Exception e) {
helper.error(SimpleLocation.UNKNOWN, "Parsing error: %s", e.getMessage());
return null;
helper.error(SimpleLocation.UNKNOWN, "Parsing error or Empty YAML document");
return null;
helper.error(tree, "Expected a map as a root object.");
return null;
helper.error(tree, "Expected a field '%s' specifying the configuration type "
+ "name in root object.", TYPE_KEY);
return null;
Message prototype = supportedConfigTypes.get(typeName);
if (prototype == null) {
helper.error(tree, "The specified configuration type '%s' is unknown.",
typeName);
return null;
代码示例来源:origin: com.google.api/api-compiler
tree = YAML.compose(new StringReader(input));
} catch (ComposerException e) {
helper.error(e.getProblemMark(), "Parsing error: %s", e.getMessage());
return null;
} catch (Exception e) {
helper.error(SimpleLocation.UNKNOWN, "Parsing error: %s", e.getMessage());
return null;
helper.error(SimpleLocation.UNKNOWN, "Parsing error or Empty YAML document");
return null;
helper.error(tree, "Expected a map as a root object.");
return null;
helper.error(tree, "Expected a field '%s' specifying the configuration type "
+ "name in root object.", TYPE_KEY);
return null;
Message prototype = supportedConfigTypes.get(typeName);
if (prototype == null) {
helper.error(tree, "The specified configuration type '%s' is unknown.",
typeName);
return null;
代码示例来源:origin: com.google.api/api-compiler
helper.error(node, "Expected a map to merge with '%s', found '%s'.",
messageType.getFullName(), node.getNodeId());
return;
helper.error(entry.getKeyNode(), "Found field '%s' which is unknown in '%s'.", key,
messageType.getFullName());
} else {
代码示例来源:origin: googleapis/api-compiler
helper.error(node, "Expected a map to merge with '%s', found '%s'.",
messageType.getFullName(), node.getNodeId());
return;
helper.error(entry.getKeyNode(), "Found field '%s' which is unknown in '%s'.", key,
messageType.getFullName());
} else {
内容来源于网络,如有侵权,请联系作者删除!