public DocumentStartEvent(Mark startMark, Mark endMark, boolean explicit, Version version, Map<String, String> tags) { super(startMark, endMark); this.explicit = explicit; this.version = version; // TODO enforce not null // if (tags == null) { // throw new NullPointerException("Tags must be provided."); // } this.tags = tags; }
String prepareVersion(Version version) { if (version.getRepresentation().startsWith("1.")) // compatibility { throw new EmitterException("unsupported YAML version: " + version); } return version.getRepresentation(); }
private void parseDocument() { if (scanner.checkToken(Token.ID.Directive)) { scanner.getToken(Token.ID.Directive); } scanner.getToken(Token.ID.DocumentStart); events.add(new DocumentStartEvent(null, null, true, Version.V1_1, null)); parseNode(); events.add(new DocumentEndEvent(null, null, true)); }
String prepareVersion(Version version) { if (version.major() != 1) { throw new EmitterException("unsupported YAML version: " + version); } return version.getRepresentation(); }
public VersionTagsTuple(Version version, Map<String, String> tags) { this.version = version; this.tags = tags; }
public Version getVersion() { return version; }
private String prepareVersion(Version version) { if (version.major() != 1) { throw new EmitterException("不支持的 YAML 版本: " + version); } return version.getRepresentation(); }
private String prepareVersion(Version version) { if (version.major() != 1) { throw new EmitterException("unsupported YAML version: " + version); } return version.getRepresentation(); }
public void testToString() { VersionTagsTuple tuple = new VersionTagsTuple(Version.V1_1, new HashMap<String, String>()); assertEquals("VersionTagsTuple<Version: 1.1, {}>", tuple.toString()); }
private String prepareVersion(Version version) { if (version.getArray()[0] != 1) { throw new EmitterException("unsupported YAML version: " + version); } return version.getRepresentation(); }
/** * YAML version the document conforms to. * * @return <code>null</code>if the document has no explicit * <code>%YAML</code> directive. Otherwise an array with two * components, the major and minor part of the version (in this * order). */ public Version getVersion() { return version; }