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


Java Converter类代码示例

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


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

示例1: lookup

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public Converter lookup(Class type) throws Exception {
    Converter converter = super.lookup(type);
    if (converter == null) {
        if (Type.class.isAssignableFrom(type))
            return TypeConverter.getInstance();
        else if (Charset.class.isAssignableFrom(type))
            return super.lookup(Charset.class);
        // This cannot be Serializable because that would cause ArrayList etc to get b0rked.
        else if (Throwable.class.isAssignableFrom(type)) // Includes Throwable.
            return super.lookup(Serializable.class);
        // else if (TBase.class.isAssignableFrom(type)) return super.lookup(TBase.class);
        // bind(type, converter);
    }
    // LOG.info("Convert " + type + " using " + converter, new Exception());
    return converter;
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:19,代码来源:PersisterFactory.java

示例2: addConverters

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
private static void addConverters(@Nonnull Registry registry, @Nonnull Serializer serializer, @Nonnull Iterable<? extends ConverterFactory> factories) {
    // LOG.info("Loading ConverterFactory instances.");
    for (ConverterFactory factory : factories) {
        // LOG.info("Factory " + factory);
        for (Map.Entry<? extends Class<?>, ? extends Converter<?>> e : factory.newConverters(serializer)) {
            // LOG.info("Register " + e.getKey() + " -> " + e.getValue());
            try {
                registry.bind(e.getKey(), e.getValue());
            } catch (Exception ex) {
                LOG.error("Failed to bind " + e.getKey() + " to " + e.getValue(), ex);
            }
        }
    }
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:15,代码来源:PersisterFactory.java

示例3: newConverters

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Arrays.asList(
            Maps.immutableEntry(Type.class, this),
            Maps.immutableEntry(Class.class, this)
    );
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:8,代码来源:TypeConverter.java

示例4: newConverters

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Arrays.asList(
            Maps.immutableEntry(InetAddress.class, this),
            Maps.immutableEntry(Inet4Address.class, this),
            Maps.immutableEntry(Inet6Address.class, this));
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:8,代码来源:InetAddressConverter.java

示例5: newConverters

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(HardwareAddress.class, this));
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:5,代码来源:HardwareAddressConverter.java

示例6: newConverters

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(InterfaceAddress.class, this));
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:5,代码来源:InterfaceAddressConverter.java

示例7: newConverters

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(NetworkAddress.class, this));
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:5,代码来源:NetworkAddressConverter.java

示例8: newConverters

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(InetSocketAddress.class, this));
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:5,代码来源:InetSocketAddressConverter.java

示例9: newConverters

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")  // Generic array creation.
public Iterable<? extends Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singletonList(Maps.immutableEntry(UUID.class, this));
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:6,代码来源:UUIDConverter.java

示例10: newConverters

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(byte[].class, this));
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:5,代码来源:ByteArrayConverter.java

示例11: newConverters

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
@Override
public Iterable<? extends Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(Serializable.class, this));
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:5,代码来源:SerializableConverter.java

示例12: newConverters

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")  // Generic array creation.
public Iterable<? extends Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singletonList(Maps.immutableEntry(URI.class, this));
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:6,代码来源:URIConverter.java

示例13: newConverters

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(double[].class, this));
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:5,代码来源:DoubleArrayConverter.java

示例14: newConverters

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(long[].class, this));
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:5,代码来源:LongArrayConverter.java

示例15: newConverters

import org.simpleframework.xml.convert.Converter; //导入依赖的package包/类
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(float[].class, this));
}
 
开发者ID:shevek,项目名称:simple-xml-serializers,代码行数:5,代码来源:FloatArrayConverter.java


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