当前位置: 首页>>代码示例>>Java>>正文


Java Representer.setPropertyUtils方法代码示例

本文整理汇总了Java中org.yaml.snakeyaml.representer.Representer.setPropertyUtils方法的典型用法代码示例。如果您正苦于以下问题:Java Representer.setPropertyUtils方法的具体用法?Java Representer.setPropertyUtils怎么用?Java Representer.setPropertyUtils使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.yaml.snakeyaml.representer.Representer的用法示例。


在下文中一共展示了Representer.setPropertyUtils方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Yaml

import org.yaml.snakeyaml.representer.Representer; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:32,代码来源:Yaml.java

示例2: Yaml

import org.yaml.snakeyaml.representer.Representer; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:RoccoDev,项目名称:5zig-TIMV-Plugin,代码行数:39,代码来源:Yaml.java

示例3: newYaml

import org.yaml.snakeyaml.representer.Representer; //导入方法依赖的package包/类
public static Yaml newYaml() {
  PropertyUtils propertyUtils = new AdvancedPropertyUtils();
  propertyUtils.setSkipMissingProperties(true);

  Constructor constructor = new Constructor(Federations.class);
  TypeDescription federationDescription = new TypeDescription(Federations.class);
  federationDescription.putListPropertyType("federatedMetaStores", FederatedMetaStore.class);
  constructor.addTypeDescription(federationDescription);
  constructor.setPropertyUtils(propertyUtils);

  Representer representer = new AdvancedRepresenter();
  representer.setPropertyUtils(new FieldOrderPropertyUtils());
  representer.addClassTag(Federations.class, Tag.MAP);
  representer.addClassTag(AbstractMetaStore.class, Tag.MAP);
  representer.addClassTag(WaggleDanceConfiguration.class, Tag.MAP);
  representer.addClassTag(YamlStorageConfiguration.class, Tag.MAP);
  representer.addClassTag(GraphiteConfiguration.class, Tag.MAP);

  DumperOptions dumperOptions = new DumperOptions();
  dumperOptions.setIndent(2);
  dumperOptions.setDefaultFlowStyle(FlowStyle.BLOCK);

  return new Yaml(constructor, representer, dumperOptions);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:25,代码来源:YamlFactory.java

示例4: testErrorMessage

import org.yaml.snakeyaml.representer.Representer; //导入方法依赖的package包/类
public void testErrorMessage() throws Exception {

        BeanA1 b = new BeanA1();
        b.setId(2l);
        b.setName("name1");

        Constructor c = new Constructor();
        Representer r = new Representer();

        PropertyUtils pu = new PropertyUtils();
        c.setPropertyUtils(pu);
        r.setPropertyUtils(pu);

        pu.getProperties(BeanA1.class, BeanAccess.FIELD);

        Yaml yaml = new Yaml(c, r);
        // yaml.setBeanAccess(BeanAccess.FIELD);
        String dump = yaml.dump(b);
        BeanA1 b2 = (BeanA1) yaml.load(dump);
        assertEquals(b.getId(), b2.getId());
        assertEquals(b.getName(), b2.getName());
    }
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:23,代码来源:AbstractBeanTest.java

示例5: Yaml

import org.yaml.snakeyaml.representer.Representer; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:32,代码来源:Yaml.java

示例6: Yaml

import org.yaml.snakeyaml.representer.Representer; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:29,代码来源:Yaml.java

示例7: testYamlRepresenterWithPropertyUtils

import org.yaml.snakeyaml.representer.Representer; //导入方法依赖的package包/类
public void testYamlRepresenterWithPropertyUtils() {
    Representer representer2 = new Representer();
    PropertyUtils pu = new PropertyUtils();
    representer2.setPropertyUtils(pu);
    Yaml yaml = new Yaml(representer2);
    assertSame(pu, yaml.constructor.getPropertyUtils());
    assertSame(pu, yaml.representer.getPropertyUtils());
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:9,代码来源:PropertyUtilsSharingTest.java

示例8: testYamlConstructorANDRepresenterWithPropertyUtils

import org.yaml.snakeyaml.representer.Representer; //导入方法依赖的package包/类
@Test
public void testYamlConstructorANDRepresenterWithPropertyUtils() {
    Constructor constructor = new Constructor();
    PropertyUtils pu_c = new PropertyUtils();
    constructor.setPropertyUtils(pu_c);
    Representer representer = new Representer();
    PropertyUtils pu_r = new PropertyUtils();
    representer.setPropertyUtils(pu_r);
    Yaml yaml = new Yaml(constructor, representer);
    assertSame(pu_c, yaml.constructor.getPropertyUtils());
    assertSame(pu_r, yaml.representer.getPropertyUtils());
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:13,代码来源:PropertyUtilsSharingTest.java

示例9: testReversedOrder

import org.yaml.snakeyaml.representer.Representer; //导入方法依赖的package包/类
public void testReversedOrder() {
    Representer repr = new Representer();
    repr.setPropertyUtils(new ReversedPropertyUtils());
    Yaml yaml = new Yaml(repr);
    String output = yaml.dump(getBean());
    // System.out.println(output);
    assertEquals(Util.getLocalResource("issues/issue59-1.yaml"), output);
}
 
开发者ID:cuizhennan,项目名称:snakeyaml,代码行数:9,代码来源:CustomOrderTest.java

示例10: testUnsorted

import org.yaml.snakeyaml.representer.Representer; //导入方法依赖的package包/类
public void testUnsorted() {
    Representer repr = new Representer();
    repr.setPropertyUtils(new UnsortedPropertyUtils());
    Yaml yaml = new Yaml(repr);
    String output = yaml.dump(getBean());
    // System.out.println(output);
    assertEquals(Util.getLocalResource("issues/issue59-2.yaml"), output);
}
 
开发者ID:cuizhennan,项目名称:snakeyaml,代码行数:9,代码来源:CustomOrderTest.java

示例11: createYaml

import org.yaml.snakeyaml.representer.Representer; //导入方法依赖的package包/类
/**
 * Creates and returns a new {@link Yaml} instance for (optional)
 * use in writing {@link ConfigOrBuilder} and {@link
 * MetadataOrBuilder} objects.
 *
 * <p>This method never returns {@code null}.</p>
 *
 * <p>Overrides of this method must not return {@code null}.</p>
 *
 * <p>Behavior is undefined if overrides of this method interact
 * with other methods defined by this class.</p>
 *
 * @return a non-{@code null} {@link Yaml} instance
 */
protected Yaml createYaml() {
  final Representer representer = new TerseRepresenter();
  representer.setPropertyUtils(new CustomPropertyUtils());
  final DumperOptions options = new DumperOptions();
  options.setAllowReadOnlyProperties(true);
  return new Yaml(new Constructor(), representer, options);
}
 
开发者ID:microbean,项目名称:microbean-helm,代码行数:22,代码来源:AbstractChartWriter.java


注:本文中的org.yaml.snakeyaml.representer.Representer.setPropertyUtils方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。