use of org.yaml.snakeyaml.introspector.PropertyUtils in project es6draft by anba.
the class Test262Info method readYaml.
private void readYaml(String descriptor, boolean lenient) throws MalformedDataException {
assert descriptor != null && !descriptor.isEmpty();
Yaml yaml = null;
if (lenient) {
yaml = yamlQueue.poll();
}
if (yaml == null) {
Constructor constructor = new Constructor(TestDescriptor.class);
if (lenient) {
PropertyUtils utils = new PropertyUtils();
utils.setSkipMissingProperties(true);
constructor.setPropertyUtils(utils);
}
yaml = new Yaml(constructor);
}
TestDescriptor desc;
try {
desc = yaml.loadAs(descriptor, TestDescriptor.class);
} catch (YAMLException e) {
throw new MalformedDataException(e.getMessage(), e);
}
if (lenient) {
yamlQueue.offer(yaml);
}
this.description = desc.getDescription();
this.includes = desc.getIncludes();
this.features = desc.getFeatures();
this.errorType = desc.getNegative();
this.negative = desc.getNegative() != null;
if (!desc.getFlags().isEmpty()) {
if (!lenient) {
for (String flag : desc.getFlags()) {
if (!allowedFlags.contains(flag)) {
throw new MalformedDataException(String.format("Unknown flag '%s'", flag));
}
}
}
this.negative |= desc.getFlags().contains("negative");
this.noStrict = desc.getFlags().contains("noStrict");
this.onlyStrict = desc.getFlags().contains("onlyStrict");
this.module = desc.getFlags().contains("module");
this.raw = desc.getFlags().contains("raw");
}
}
use of org.yaml.snakeyaml.introspector.PropertyUtils in project Apktool by iBotPeaches.
the class MetaInfo method getYaml.
private static Yaml getYaml() {
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
StringExRepresent representer = new StringExRepresent();
PropertyUtils propertyUtils = representer.getPropertyUtils();
propertyUtils.setSkipMissingProperties(true);
return new Yaml(new StringExConstructor(), representer, options);
}
Aggregations