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


Java Represent类代码示例

本文整理汇总了Java中org.yaml.snakeyaml.representer.Represent的典型用法代码示例。如果您正苦于以下问题:Java Represent类的具体用法?Java Represent怎么用?Java Represent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addSerializer

import org.yaml.snakeyaml.representer.Represent; //导入依赖的package包/类
public static final <T> void addSerializer(ExtensibleRepresenter representer, Class<T> type,
		Function<T, String> function) {
	representer.addRepresenter(type, new Represent() {

		@SuppressWarnings("unchecked")
		@Override
		public Node representData(Object data) {
			String txt = function.apply((T) data);
			if (txt == null) {
				return new ScalarNode(Tag.NULL, "null", null, null, null);
			}
			return new ScalarNode(Tag.STR, txt, null, null, null);
		}

	});
}
 
开发者ID:berkesa,项目名称:datatree-adapters,代码行数:17,代码来源:YamlSnakeYaml.java

示例2: initialValue

import org.yaml.snakeyaml.representer.Represent; //导入依赖的package包/类
@Override
protected Yaml initialValue()
{
    Representer representer = new Representer() {
        {
            representers.put(Configuration.class, new Represent() {
                @Override
                public Node representData(Object data)
                {
                    return represent(((Configuration) data).self);
                }
            });
        }
    };

    DumperOptions options = new DumperOptions();
    options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);

    return new Yaml(new Constructor(), representer, options);
}
 
开发者ID:Dytanic,项目名称:CloudNet,代码行数:21,代码来源:YamlConfiguration.java

示例3: Representer

import org.yaml.snakeyaml.representer.Represent; //导入依赖的package包/类
public Representer()
{
    this.nullRepresenter = new RepresentNull(this);
    this.representers.put(String.class, new RepresentString(this));
    this.representers.put(Boolean.class, new RepresentBoolean(this));
    this.representers.put(Character.class, new RepresentString(this));
    this.representers.put(UUID.class, new RepresentUuid(this));
    this.representers.put(byte[].class, new RepresentByteArray(this));

    Represent primitiveArray = new RepresentPrimitiveArray(this);
    this.representers.put(short[].class, primitiveArray);
    this.representers.put(int[].class, primitiveArray);
    this.representers.put(long[].class, primitiveArray);
    this.representers.put(float[].class, primitiveArray);
    this.representers.put(double[].class, primitiveArray);
    this.representers.put(char[].class, primitiveArray);
    this.representers.put(boolean[].class, primitiveArray);

    this.classTags = new HashMap<>(10);


    this.representers.put(null, new RepresentJavaBean(this));
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:24,代码来源:Representer.java

示例4: initialValue

import org.yaml.snakeyaml.representer.Represent; //导入依赖的package包/类
@Override
protected Yaml initialValue()
{
    Representer representer = new Representer()
    {
        {
            representers.put( Configuration.class, new Represent()
            {
                @Override
                public Node representData(Object data)
                {
                    return represent( ( (Configuration) data ).self );
                }
            } );
        }
    };

    DumperOptions options = new DumperOptions();
    options.setDefaultFlowStyle( DumperOptions.FlowStyle.BLOCK );

    return new Yaml( new Constructor(), representer, options );
}
 
开发者ID:tylerhasman,项目名称:MapleStory,代码行数:23,代码来源:YamlConfiguration.java

示例5: addRepresenter

import org.yaml.snakeyaml.representer.Represent; //导入依赖的package包/类
public void addRepresenter(Class<?> type, Represent represent) {
	representers.put(type, represent);
}
 
开发者ID:berkesa,项目名称:datatree-adapters,代码行数:4,代码来源:YamlSnakeYaml.java

示例6: addRepresenter

import org.yaml.snakeyaml.representer.Represent; //导入依赖的package包/类
public void addRepresenter(Class<?> type, Represent represent)
{
    this.representers.put(type, represent);
    LinkedHashMap<Class<?>, Represent> multiRepresenters = (LinkedHashMap<Class<?>, Represent>) this.multiRepresenters;
    multiRepresenters.put(type, represent);
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:7,代码来源:Representer.java

示例7: getRepresenters

import org.yaml.snakeyaml.representer.Represent; //导入依赖的package包/类
/**
 * Returns representers map of this yaml representer instance.
 *
 * @return representers map of this yaml representer instance.
 */
public Map<Class<?>, Represent> getRepresenters()
{
    return this.representers;
}
 
开发者ID:Diorite,项目名称:Diorite-old,代码行数:10,代码来源:DioriteYamlRepresenter.java

示例8: getNullRepresenter

import org.yaml.snakeyaml.representer.Represent; //导入依赖的package包/类
/**
 * Returns null representer of this yaml representer instance.
 *
 * @return null representer of this yaml representer instance.
 */
public Represent getNullRepresenter()
{
    return this.nullRepresenter;
}
 
开发者ID:Diorite,项目名称:Diorite-old,代码行数:10,代码来源:DioriteYamlRepresenter.java

示例9: setNullRepresenter

import org.yaml.snakeyaml.representer.Represent; //导入依赖的package包/类
/**
 * Set null representer of this yaml representer instance.
 *
 * @param nullRepresenter new null representer.
 */
public void setNullRepresenter(final Represent nullRepresenter)
{
    this.nullRepresenter = nullRepresenter;
}
 
开发者ID:Diorite,项目名称:Diorite-old,代码行数:10,代码来源:DioriteYamlRepresenter.java

示例10: getMultiRepresenters

import org.yaml.snakeyaml.representer.Represent; //导入依赖的package包/类
/**
 * Returns representers map of this yaml representer instance.
 *
 * @return representers map of this yaml representer instance.
 */
public Map<Class<?>, Represent> getMultiRepresenters()
{
    return this.multiRepresenters;
}
 
开发者ID:Diorite,项目名称:Diorite-old,代码行数:10,代码来源:DioriteYamlRepresenter.java

示例11: register

import org.yaml.snakeyaml.representer.Represent; //导入依赖的package包/类
/**
 * Register the {@link Represent} in {@link #representers} and
 * {@link #multiRepresenters}.
 *
 * @param type      the type to register for
 * @param represent the represent
 */
private void register(Class<? extends YamlNode> type, Represent represent) {
    this.representers.put(type, represent);
    this.multiRepresenters.put(type, represent);
}
 
开发者ID:autermann,项目名称:yaml,代码行数:12,代码来源:YamlNodeRepresenter.java


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