org.yaml.snakeyaml.events.Event类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(195)

本文整理了Java中org.yaml.snakeyaml.events.Event类的一些代码示例,展示了Event类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event类的具体详情如下:
包路径:org.yaml.snakeyaml.events.Event
类名称:Event

Event介绍

[英]Basic unit of output from a org.yaml.snakeyaml.parser.Parser or input of a org.yaml.snakeyaml.emitter.Emitter.
[中]组织输出的基本单位。亚马尔。毒蛇。解析器。组织的解析器或输入。亚马尔。毒蛇。发射器。发射器。

代码示例

代码示例来源:origin: redisson/redisson

/**
 * Check the type of the next event.
 */
public boolean checkEvent(Event.ID choice) {
  peekEvent();
  return currentEvent != null && currentEvent.is(choice);
}

代码示例来源:origin: redisson/redisson

if (!evt.is(Event.ID.Scalar)) {
    if (evt.is(Event.ID.MappingEnd)) {
      if (!_parsingContext.inObject()) { // sanity check is optional, but let's do it for now
        _reportMismatchedEndMarker('}', ']');
if (evt.is(Event.ID.Scalar)) {
  JsonToken t = _decodeScalar((ScalarEvent) evt);
  _currToken = t;
if (evt.is(Event.ID.MappingStart)) {
  Mark m = evt.getStartMark();
  MappingStartEvent map = (MappingStartEvent) evt;
  _currentAnchor = map.getAnchor();
if (evt.is(Event.ID.MappingEnd)) { // actually error; can not have map-end here
  _reportError("Not expecting END_OBJECT but a value");
if (evt.is(Event.ID.SequenceStart)) {
  Mark m = evt.getStartMark();
  _currentAnchor = ((NodeEvent)evt).getAnchor();
  _parsingContext = _parsingContext.createChildArrayContext(m.getLine(), m.getColumn());
  return (_currToken = JsonToken.START_ARRAY);
if (evt.is(Event.ID.SequenceEnd)) {
  if (!_parsingContext.inArray()) { // sanity check is optional, but let's do it for now
    _reportMismatchedEndMarker(']', '}');
if (evt.is(Event.ID.DocumentEnd)) {

代码示例来源:origin: redisson/redisson

@Override
public JsonLocation getCurrentLocation() {
  // can assume we are at the end of token now...
  if (_lastEvent == null) {
    return JsonLocation.NA;
  }
  return _locationFor(_lastEvent.getEndMark());
}

代码示例来源:origin: redisson/redisson

@Override
public JsonLocation getTokenLocation()
{
  if (_lastEvent == null) {
    return JsonLocation.NA;
  }
  return _locationFor(_lastEvent.getStartMark());
}

代码示例来源:origin: redisson/redisson

@Override
  public int hashCode() {
    return toString().hashCode();
  }
}

代码示例来源:origin: redisson/redisson

public String toString() {
  return "<" + this.getClass().getName() + "(" + getArguments() + ")>";
}

代码示例来源:origin: com.fasterxml.jackson.dataformat/jackson-dataformat-yaml

@Override
public JsonLocation getTokenLocation()
{
  if (_lastEvent == null) {
    return JsonLocation.NA;
  }
  return _locationFor(_lastEvent.getStartMark());
}

代码示例来源:origin: redisson/redisson

@Override
public boolean equals(Object obj) {
  if (obj instanceof Event) {
    return toString().equals(obj.toString());
  } else {
    return false;
  }
}

代码示例来源:origin: pl.droidsonroids.yaml/snakeyaml

public String toString() {
  return "<" + this.getClass().getName() + "(" + getArguments() + ")>";
}

代码示例来源:origin: pl.droidsonroids.yaml/snakeyaml

/**
 * Check the type of the next event.
 */
public boolean checkEvent(Event.ID choice) {
  peekEvent();
  return currentEvent != null && currentEvent.is(choice);
}

代码示例来源:origin: com.fasterxml.jackson.dataformat/jackson-dataformat-yaml

if (!evt.is(Event.ID.Scalar)) {
    if (evt.is(Event.ID.MappingEnd)) {
      if (!_parsingContext.inObject()) { // sanity check is optional, but let's do it for now
        _reportMismatchedEndMarker('}', ']');
if (evt.is(Event.ID.Scalar)) {
  JsonToken t = _decodeScalar((ScalarEvent) evt);
  _currToken = t;
if (evt.is(Event.ID.MappingStart)) {
  Mark m = evt.getStartMark();
  MappingStartEvent map = (MappingStartEvent) evt;
  _currentAnchor = map.getAnchor();
if (evt.is(Event.ID.MappingEnd)) { // actually error; can not have map-end here
  _reportError("Not expecting END_OBJECT but a value");
if (evt.is(Event.ID.SequenceStart)) {
  Mark m = evt.getStartMark();
  _currentAnchor = ((NodeEvent)evt).getAnchor();
  _parsingContext = _parsingContext.createChildArrayContext(m.getLine(), m.getColumn());
  return (_currToken = JsonToken.START_ARRAY);
if (evt.is(Event.ID.SequenceEnd)) {
  if (!_parsingContext.inArray()) { // sanity check is optional, but let's do it for now
    _reportMismatchedEndMarker(']', '}');
if (evt.is(Event.ID.DocumentEnd)) {

代码示例来源:origin: redisson/redisson

/**
 * Reads a document from a source that contains only one document.
 * <p>
 * If the stream contains more than one document an exception is thrown.
 * </p>
 *
 * @return The root node of the document or <code>null</code> if no document
 * is available.
 */
public Node getSingleNode() {
  // Drop the STREAM-START event.
  parser.getEvent();
  // Compose a document if the stream is not empty.
  Node document = null;
  if (!parser.checkEvent(Event.ID.StreamEnd)) {
    document = getNode();
  }
  // Ensure that the stream contains no more documents.
  if (!parser.checkEvent(Event.ID.StreamEnd)) {
    Event event = parser.getEvent();
    throw new ComposerException("expected a single document in the stream",
        document.getStartMark(), "but found another document", event.getStartMark());
  }
  // Drop the STREAM-END event.
  parser.getEvent();
  return document;
}

代码示例来源:origin: com.fasterxml.jackson.dataformat/jackson-dataformat-yaml

@Override
public JsonLocation getCurrentLocation() {
  // can assume we are at the end of token now...
  if (_lastEvent == null) {
    return JsonLocation.NA;
  }
  return _locationFor(_lastEvent.getEndMark());
}

代码示例来源:origin: pl.droidsonroids.yaml/snakeyaml

@Override
  public int hashCode() {
    return toString().hashCode();
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

public String toString() {
  return "<" + this.getClass().getName() + "(" + getArguments() + ")>";
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Check the type of the next event.
 */
public boolean checkEvent(Event.ID choice) {
  peekEvent();
  return currentEvent != null && currentEvent.is(choice);
}

代码示例来源:origin: harbby/presto-connectors

if (!evt.is(Event.ID.Scalar)) {
    if (evt.is(Event.ID.MappingEnd)) {
      if (!_parsingContext.inObject()) { // sanity check is optional, but let's do it for now
        _reportMismatchedEndMarker('}', ']');
if (evt.is(Event.ID.Scalar)) {
  JsonToken t = _decodeScalar((ScalarEvent) evt);
  _currToken = t;
if (evt.is(Event.ID.MappingStart)) {
  Mark m = evt.getStartMark();
  MappingStartEvent map = (MappingStartEvent) evt;
  _currentAnchor = map.getAnchor();
if (evt.is(Event.ID.MappingEnd)) { // actually error; can not have map-end here
  _reportError("Not expecting END_OBJECT but a value");
if (evt.is(Event.ID.SequenceStart)) {
  Mark m = evt.getStartMark();
  _currentAnchor = ((NodeEvent)evt).getAnchor();
  _parsingContext = _parsingContext.createChildArrayContext(m.getLine(), m.getColumn());
  return (_currToken = JsonToken.START_ARRAY);
if (evt.is(Event.ID.SequenceEnd)) {
  if (!_parsingContext.inArray()) { // sanity check is optional, but let's do it for now
    _reportMismatchedEndMarker(']', '}');
if (evt.is(Event.ID.DocumentEnd)) {

代码示例来源:origin: geotools/geotools

private void end(Event evt, YsldValidateContext context) {
  if (state == State.STARTED) {
    depth--;
    if (depth == 0) {
      state = State.DONE;
      context.pop();
    }
  } else {
    context.error(
        "Unexpected End of "
            + ((evt instanceof MappingEndEvent) ? "Mapping" : "Sequence"),
        evt.getStartMark());
  }
}

代码示例来源: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: com.impetus.fabric/fabric-jdbc-driver-shaded

@Override
  public int hashCode() {
    return toString().hashCode();
  }
}

相关文章