/** * Create Yaml instance. It is safe to create a few instances and use them * in different Threads. * * @param constructor * BaseConstructor to construct incoming documents * @param representer * Representer to emit outgoing objects * @param dumperOptions * DumperOptions to configure outgoing objects * @param resolver * Resolver to detect implicit type */ public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions, Resolver resolver) { if (!constructor.isExplicitPropertyUtils()) { constructor.setPropertyUtils(representer.getPropertyUtils()); } else if (!representer.isExplicitPropertyUtils()) { representer.setPropertyUtils(constructor.getPropertyUtils()); } this.constructor = constructor; representer.setDefaultFlowStyle(dumperOptions.getDefaultFlowStyle()); representer.setDefaultScalarStyle(dumperOptions.getDefaultScalarStyle()); representer.getPropertyUtils().setAllowReadOnlyProperties( dumperOptions.isAllowReadOnlyProperties()); representer.setTimeZone(dumperOptions.getTimeZone()); this.representer = representer; this.dumperOptions = dumperOptions; this.resolver = resolver; this.name = "Yaml:" + System.identityHashCode(this); }
/** * Create Yaml instance. It is safe to create a few instances and use them * in different Threads. * * @param constructor * BaseConstructor to construct incoming documents * @param representer * Representer to emit outgoing objects * @param dumperOptions * DumperOptions to configure outgoing objects * @param loadingConfig * LoadingConfig to control load behavior * @param resolver * Resolver to detect implicit type */ public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions, LoaderOptions loadingConfig, Resolver resolver) { if (!constructor.isExplicitPropertyUtils()) { constructor.setPropertyUtils(representer.getPropertyUtils()); } else if (!representer.isExplicitPropertyUtils()) { representer.setPropertyUtils(constructor.getPropertyUtils()); } this.constructor = constructor; this.constructor.setAllowDuplicateKeys(loadingConfig.isAllowDuplicateKeys()); if (dumperOptions.getIndent() <= dumperOptions.getIndicatorIndent()) { throw new YAMLException("Indicator indent must be smaller then indent."); } representer.setDefaultFlowStyle(dumperOptions.getDefaultFlowStyle()); representer.setDefaultScalarStyle(dumperOptions.getDefaultScalarStyle()); representer.getPropertyUtils() .setAllowReadOnlyProperties(dumperOptions.isAllowReadOnlyProperties()); representer.setTimeZone(dumperOptions.getTimeZone()); this.representer = representer; this.dumperOptions = dumperOptions; this.loadingConfig = loadingConfig; this.resolver = resolver; this.name = "Yaml:" + System.identityHashCode(this); }
/** * Create Yaml instance. It is safe to create a few instances and use them in different Threads. * * @param constructor * BaseConstructor to construct incoming documents * @param representer * Representer to emit outgoing objects * @param dumperOptions * DumperOptions to configure outgoing objects * @param resolver * Resolver to detect implicit type */ public Yaml(final BaseConstructor constructor, final Representer representer, final DumperOptions dumperOptions, final Resolver resolver) { if (!constructor.isExplicitPropertyUtils()) { constructor.setPropertyUtils(representer.getPropertyUtils()); } else if (!representer.isExplicitPropertyUtils()) { representer.setPropertyUtils(constructor.getPropertyUtils()); } this.constructor = constructor; representer.setDefaultFlowStyle(dumperOptions.getDefaultFlowStyle()); representer.setDefaultScalarStyle(dumperOptions.getDefaultScalarStyle()); representer.getPropertyUtils().setAllowReadOnlyProperties(dumperOptions.isAllowReadOnlyProperties()); representer.setTimeZone(dumperOptions.getTimeZone()); this.representer = representer; this.dumperOptions = dumperOptions; this.resolver = resolver; this.name = "Yaml:" + System.identityHashCode(this); }
public void test1() { BaseConstructor compact = new CompactConstructor(); Yaml yaml = new Yaml(compact); String doc = Util.getLocalResource("compactnotation/error1.yaml"); try { yaml.load(doc); fail("Package is not specified."); } catch (Exception e) { assertEquals("java.lang.ClassNotFoundException: Table", e.getMessage()); } }
public BaseConstructor getConstructor() { return constructor; }
/** * BaseConstructor to construct incoming documents. */ public void setConstructor(BaseConstructor constructor) { this.constructor = constructor; }
public Loader(BaseConstructor constructor) { super(); this.constructor = constructor; }
public MyYaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions) { super(constructor, representer, dumperOptions); }
public Loader(final BaseConstructor constructor) { super(); this.constructor = constructor; }
/** * Create Yaml instance. It is safe to create a few instances and use them * in different Threads. * * @param constructor * BaseConstructor to construct incoming documents */ public Yaml(BaseConstructor constructor) { this(constructor, new Representer()); }
/** * Create Yaml instance. It is safe to create a few instances and use them * in different Threads. * * @param constructor * BaseConstructor to construct incoming documents * @param representer * Representer to emit outgoing objects */ public Yaml(BaseConstructor constructor, Representer representer) { this(constructor, representer, new DumperOptions()); }
/** * Create Yaml instance. It is safe to create a few instances and use them * in different Threads. * * @param constructor * BaseConstructor to construct incoming documents * @param representer * Representer to emit outgoing objects * @param dumperOptions * DumperOptions to configure outgoing objects */ public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions) { this(constructor, representer, dumperOptions, new Resolver()); }
/** * Create Yaml instance. It is safe to create a few instances and use them * in different Threads. * * @param constructor * BaseConstructor to construct incoming documents * @param representer * Representer to emit outgoing objects * @param dumperOptions * DumperOptions to configure outgoing objects */ public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions) { this(constructor, representer, dumperOptions, new LoaderOptions(), new Resolver()); }
/** * Create Yaml instance. It is safe to create a few instances and use them * in different Threads. * * @param constructor * BaseConstructor to construct incoming documents * @param representer * Representer to emit outgoing objects * @param dumperOptions * DumperOptions to configure outgoing objects * @param loadingConfig * LoadingConfig to control load behavior */ public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions, LoaderOptions loadingConfig) { this(constructor, representer, dumperOptions, loadingConfig, new Resolver()); }
/** * Create Yaml instance. It is safe to create a few instances and use them * in different Threads. * * @param constructor * BaseConstructor to construct incoming documents * @param representer * Representer to emit outgoing objects * @param dumperOptions * DumperOptions to configure outgoing objects * @param resolver * Resolver to detect implicit type */ public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions, Resolver resolver) { this(constructor, representer, dumperOptions, new LoaderOptions(), resolver); }