Java 类org.simpleframework.xml.convert.Converter 实例源码

项目:simple-xml-serializers    文件:PersisterFactory.java   
@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;
}
项目:simple-xml-serializers    文件:PersisterFactory.java   
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);
            }
        }
    }
}
项目:simple-xml-serializers    文件:TypeConverter.java   
@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)
    );
}
项目:simple-xml-serializers    文件:InetAddressConverter.java   
@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));
}
项目:simple-xml-serializers    文件:HardwareAddressConverter.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(HardwareAddress.class, this));
}
项目:simple-xml-serializers    文件:InterfaceAddressConverter.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(InterfaceAddress.class, this));
}
项目:simple-xml-serializers    文件:NetworkAddressConverter.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(NetworkAddress.class, this));
}
项目:simple-xml-serializers    文件:InetSocketAddressConverter.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(InetSocketAddress.class, this));
}
项目:simple-xml-serializers    文件:UUIDConverter.java   
@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));
}
项目:simple-xml-serializers    文件:ByteArrayConverter.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(byte[].class, this));
}
项目:simple-xml-serializers    文件:SerializableConverter.java   
@Override
public Iterable<? extends Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(Serializable.class, this));
}
项目:simple-xml-serializers    文件:URIConverter.java   
@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));
}
项目:simple-xml-serializers    文件:DoubleArrayConverter.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(double[].class, this));
}
项目:simple-xml-serializers    文件:LongArrayConverter.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(long[].class, this));
}
项目:simple-xml-serializers    文件:FloatArrayConverter.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(float[].class, this));
}
项目:simple-xml-serializers    文件:ShortArrayConverter.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(short[].class, this));
}
项目:simple-xml-serializers    文件:IntegerArrayConverter.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(int[].class, this));
}
项目:simple-xml-serializers    文件:ConverterFactory.java   
@Nonnull
public Iterable<? extends Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(@Nonnull Serializer serializer);
项目:simple-xml-serializers    文件:ThriftConverter.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters(Serializer serializer) {
    return Collections.singleton(Maps.immutableEntry(TBase.class, this));
}