本文整理汇总了Java中org.simpleframework.xml.transform.Transform类的典型用法代码示例。如果您正苦于以下问题:Java Transform类的具体用法?Java Transform怎么用?Java Transform使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Transform类属于org.simpleframework.xml.transform包,在下文中一共展示了Transform类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: match
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public Transform match(Class type) throws Exception {
Transform transform = super.match(type);
if (transform == null) {
if (Type.class.isAssignableFrom(type))
transform = TypeTransform.getInstance();
else if (Throwable.class.isAssignableFrom(type))
transform = SerializableTransform.getInstance();
else if (Charset.class.isAssignableFrom(type))
return super.match(Charset.class);
// bind(type, transform);
}
// LOG.info("Transform " + type + " using " + transform, new Exception());
return transform;
}
示例2: match
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
@Override
public Transform<?> match(Class type) throws Exception {
if(Condition.class.isAssignableFrom(type)){
return new Transform<Condition>() {
@Override
public Condition read(String s) throws Exception {
return Condition.makeCondition(s);
}
@Override
public String write(Condition condition) throws Exception {
return condition.toString();
}
};
}
return null;
}
示例3: match
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public Transform<?> match(Class type) throws Exception {
if (type.equals(Coordinate.class)) return new CoordinateTransformer();
else if (type.equals(Coordinates.class)) return new CoordinatesTransformer();
return null;
}
示例4: createPersister
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
public static Persister createPersister(final Account account) {
return new Persister(new Matcher() {
@Override
public Transform match(Class type) throws Exception {
if (Date.class.isAssignableFrom(type)) {
return new DateTransform(account);
} else if (Uri.class.isAssignableFrom(type)) {
return new UriTransform(account);
}
return null;
}
});
}
示例5: match
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
@Override
public Transform match(Class type) throws Exception {
if (type.equals(Integer.class)) {
return new IntegerTransformer();
}
return null;
}
示例6: addTransformers
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
private static void addTransformers(@Nonnull RegistryMatcher matcher, @Nonnull Serializer serializer, @Nonnull Iterable<? extends TransformFactory> factories) {
for (TransformFactory factory : factories) {
// LOG.info("Factory " + factory);
for (Map.Entry<? extends Class<?>, ? extends Transform<?>> e : factory.newTransforms()) {
// LOG.info("Register " + e.getKey() + " -> " + e.getValue());
try {
matcher.bind(e.getKey(), e.getValue());
} catch (Exception ex) {
LOG.error("Failed to bind " + e.getKey() + " to " + e.getValue(), ex);
}
}
}
}
示例7: newTransforms
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
return Arrays.asList(
Maps.immutableEntry(Type.class, this),
Maps.immutableEntry(Class.class, this)
);
}
示例8: newTransforms
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Iterable<? extends Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
return Arrays.asList(
Maps.immutableEntry(InetAddress.class, this),
Maps.immutableEntry(Inet4Address.class, this),
Maps.immutableEntry(Inet6Address.class, this));
}
示例9: newRegistryMatcher
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
@Nonnull
private static RegistryMatcher newRegistryMatcher() {
RegistryMatcher matcher = new RegistryMatcher() {
@Override
public Transform match(Class type) throws Exception {
if (Type.class.isAssignableFrom(type))
return TypeTransform.getInstance();
return super.match(type);
}
};
return matcher;
}
示例10: unUnloaded
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
@Override
public void unUnloaded() {
SerializeHelper sh = SerializeHelper.get();
for(Entry<Class<?>, Class<? extends Transform<?>>> entry : matcherMap.entrySet()) {
sh.removeTransformMapping(entry.getKey());
}
matcherMap.clear();
}
示例11: match
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public Transform match(Class type) throws Exception {
if (Date.class.equals(type)) {
return new AbcDateTransform();
}
return null;
}
示例12: newTransforms
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
return Collections.singletonList(Maps.immutableEntry(InterfaceAddress.class, this));
}
示例13: newTransforms
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
return Collections.singletonList(Maps.immutableEntry(NetworkAddress.class, this));
}
示例14: newTransforms
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
return Collections.singletonList(Maps.immutableEntry(HardwareAddress.class, this));
}
示例15: newTransforms
import org.simpleframework.xml.transform.Transform; //导入依赖的package包/类
@Override
public Iterable<? extends Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
return Collections.singleton(Maps.immutableEntry(double[].class, this));
}