當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。