Java 类org.yaml.snakeyaml.representer.Represent 实例源码

项目:CloudNet    文件:YamlConfiguration.java   
@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);
}
项目:datatree-adapters    文件:YamlSnakeYaml.java   
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);
        }

    });
}
项目:diorite-configs-java8    文件:Representer.java   
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));
}
项目:MapleStory    文件:YamlConfiguration.java   
@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 );
}
项目:Diorite    文件:Representer.java   
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));
}
项目:datatree-adapters    文件:YamlSnakeYaml.java   
public void addRepresenter(Class<?> type, Represent represent) {
    representers.put(type, represent);
}
项目:diorite-configs-java8    文件:Representer.java   
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);
}
项目:Diorite    文件:Representer.java   
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);
}
项目:Diorite-old    文件:DioriteYamlRepresenter.java   
/**
 * Returns representers map of this yaml representer instance.
 *
 * @return representers map of this yaml representer instance.
 */
public Map<Class<?>, Represent> getRepresenters()
{
    return this.representers;
}
项目:Diorite-old    文件:DioriteYamlRepresenter.java   
/**
 * Returns null representer of this yaml representer instance.
 *
 * @return null representer of this yaml representer instance.
 */
public Represent getNullRepresenter()
{
    return this.nullRepresenter;
}
项目:Diorite-old    文件:DioriteYamlRepresenter.java   
/**
 * Set null representer of this yaml representer instance.
 *
 * @param nullRepresenter new null representer.
 */
public void setNullRepresenter(final Represent nullRepresenter)
{
    this.nullRepresenter = nullRepresenter;
}
项目:Diorite-old    文件:DioriteYamlRepresenter.java   
/**
 * Returns representers map of this yaml representer instance.
 *
 * @return representers map of this yaml representer instance.
 */
public Map<Class<?>, Represent> getMultiRepresenters()
{
    return this.multiRepresenters;
}
项目:yaml    文件:YamlNodeRepresenter.java   
/**
 * 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);
}