本文整理汇总了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;
}
示例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);
}
}
}
}
示例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)
);
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}