本文整理汇总了Java中org.yaml.snakeyaml.events.Event.is方法的典型用法代码示例。如果您正苦于以下问题:Java Event.is方法的具体用法?Java Event.is怎么用?Java Event.is使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.yaml.snakeyaml.events.Event
的用法示例。
在下文中一共展示了Event.is方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expectMap
import org.yaml.snakeyaml.events.Event; //导入方法依赖的package包/类
public Map<String, String> expectMap() {
expectMappingStart();
HashMap<String, String> map = new HashMap<>();
while (true) {
Event e = peek();
if (e == null) { break; }
if (e.is(Event.ID.MappingEnd)) { break; }
map.put(
expectScalar().getValue(),
expectScalar().getValue()
);
}
expectMappingEnd();
return map;
}
示例2: expectList
import org.yaml.snakeyaml.events.Event; //导入方法依赖的package包/类
private List<String> expectList() {
expectSequenceStart();
List<String> list = new LinkedList<>();
while(true) {
Event e = peek();
if (e == null) { break; }
if (e.is(Event.ID.SequenceEnd)) { break; }
list.add(expectScalar().getValue());
}
expectSequenceEnd();
return list;
}
示例3: toApiRegistry
import org.yaml.snakeyaml.events.Event; //导入方法依赖的package包/类
private Registry toApiRegistry(Events events) {
String host = null;
Integer port = null;
events.expectMappingStart();
while (true) {
Event e = events.peek();
if (e == null) { break; }
if (e.is(Event.ID.MappingEnd)) { break; }
String name = events.expectScalar().getValue();
switch(name) {
case "host":
host = events.expectScalar().getValue();
break;
case "port":
port = Integer.parseInt(events.expectScalar().getValue());
break;
default:
throw new IllegalStateException("unknown name "+name);
}
}
events.expectMappingEnd();
Objects.requireNonNull(host, "host may be not be null for registry spec");
Objects.requireNonNull(port, "port may be not be null for registry spec");
return new RemoteRegistry(host, port);
}
示例4: expect
import org.yaml.snakeyaml.events.Event; //导入方法依赖的package包/类
public Event expect(Event.ID id) {
Event event = next();
if (! event.is(id)) {
throw new IllegalArgumentException("expected " + id + " and was " + event);
}
return event;
}
示例5: toApiHost
import org.yaml.snakeyaml.events.Event; //导入方法依赖的package包/类
private ApiHost toApiHost(Events events) {
String type = null;
String host = null;
String path = null;
String cert = null;
Integer port = null;
Optional<List<String>> volumes = Optional.empty();
events.expectMappingStart();
while (true) {
Event e = events.peek();
if (e == null) { break; }
if (e.is(Event.ID.MappingEnd)) { break; }
String name = events.expectScalar().getValue();
switch(name) {
case "type":
type = events.expectScalar().getValue();
break;
case "cert":
cert = events.expectScalar().getValue();
break;
case "host":
host = events.expectScalar().getValue();
break;
case "path":
path = events.expectScalar().getValue();
break;
case "port":
port = Integer.parseInt(events.expectScalar().getValue());
break;
case "volumes":
volumes = Optional.of(events.expectList());
break;
default:
throw new IllegalStateException("unknown name "+name);
}
}
events.expectMappingEnd();
if (type == null) {
throw new IllegalStateException("Type of API is not specified");
}
switch(type) {
case "http":
Objects.requireNonNull(host, "host may be not be null for http api");
Objects.requireNonNull(port, "port may be not be null for http api");
return new HttpRestApiHost(host, port, volumes);
case "https":
Objects.requireNonNull(host, "host may be not be null for https api");
Objects.requireNonNull(port, "port may be not be null for https api");
Objects.requireNonNull(cert, "cert may be not be null for https api");
return new HttpsRestApiHost(host, port, cert, volumes);
case "unix":
Objects.requireNonNull(cert, "path may be not be null for unix api");
return new UnixRestApiHost(path, volumes);
default:
throw new IllegalStateException("Unknown type of api " + type);
}
}
示例6: isSequenceStarting
import org.yaml.snakeyaml.events.Event; //导入方法依赖的package包/类
public boolean isSequenceStarting() {
Event e = peek();
if (e == null) { return false; }
return e.is(Event.ID.SequenceStart);
}
示例7: isDocumentStarting
import org.yaml.snakeyaml.events.Event; //导入方法依赖的package包/类
public boolean isDocumentStarting() {
Event e = peek();
if (e == null) { return false; }
return e.is(Event.ID.DocumentStart);
}
示例8: isMappingStarting
import org.yaml.snakeyaml.events.Event; //导入方法依赖的package包/类
public boolean isMappingStarting() {
Event e = peek();
if (e == null) { return false; }
return e.is(Event.ID.MappingStart);
}
示例9: isScalar
import org.yaml.snakeyaml.events.Event; //导入方法依赖的package包/类
public boolean isScalar() {
Event e = peek();
if (e == null) { return false; }
return e.is(Event.ID.Scalar);
}