Java 类org.simpleframework.xml.transform.Transform 实例源码

项目:simple-xml-serializers    文件:PersisterFactory.java   
@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;
}
项目:blindtale    文件:TaleParser.java   
@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;
}
项目:RoadLab-Pro    文件:Serializer.java   
@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;
}
项目:gitlab-android    文件:SimpleXmlProvider.java   
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;
        }
    });
}
项目:PassBeam    文件:TransformMatcher.java   
@Override
public Transform match(Class type) throws Exception {
    if (type.equals(Integer.class)) {
        return new IntegerTransformer();
    }

    return null;
}
项目:simple-xml-serializers    文件:PersisterFactory.java   
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);
            }
        }
    }
}
项目:simple-xml-serializers    文件:TypeTransform.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
    return Arrays.asList(
            Maps.immutableEntry(Type.class, this),
            Maps.immutableEntry(Class.class, this)
    );
}
项目:simple-xml-serializers    文件:InetAddressTransform.java   
@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));
}
项目:simple-xml-serializers    文件:TypeConverterTest.java   
@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;
}
项目:angerona-framework    文件:AngeronaPluginAdapter.java   
@Override
public void unUnloaded() {
    SerializeHelper sh = SerializeHelper.get();
    for(Entry<Class<?>, Class<? extends Transform<?>>> entry : matcherMap.entrySet()) {
        sh.removeTransformMapping(entry.getKey());
    }
    matcherMap.clear();
}
项目:aview    文件:AbcDateMatcher.java   
@SuppressWarnings("rawtypes")
@Override
public Transform match(Class type) throws Exception {
    if (Date.class.equals(type)) {
        return new AbcDateTransform();
    }
    return null;
}
项目:simple-xml-serializers    文件:InterfaceAddressTransform.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
    return Collections.singletonList(Maps.immutableEntry(InterfaceAddress.class, this));
}
项目:simple-xml-serializers    文件:NetworkAddressTransform.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
    return Collections.singletonList(Maps.immutableEntry(NetworkAddress.class, this));
}
项目:simple-xml-serializers    文件:HardwareAddressTransform.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
    return Collections.singletonList(Maps.immutableEntry(HardwareAddress.class, this));
}
项目:simple-xml-serializers    文件:DoubleArrayTransform.java   
@Override
public Iterable<? extends Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
    return Collections.singleton(Maps.immutableEntry(double[].class, this));
}
项目:simple-xml-serializers    文件:ShortArrayTransform.java   
@Override
public Iterable<? extends Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
    return Collections.singleton(Maps.immutableEntry(short[].class, this));
}
项目:simple-xml-serializers    文件:LongArrayTransform.java   
@Override
public Iterable<? extends Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
    return Collections.singleton(Maps.immutableEntry(long[].class, this));
}
项目:simple-xml-serializers    文件:FloatArrayTransform.java   
@Override
public Iterable<? extends Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
    return Collections.singleton(Maps.immutableEntry(float[].class, this));
}
项目:simple-xml-serializers    文件:UUIDTransform.java   
@Override
@SuppressWarnings("unchecked")  // Generic array creation
public Iterable<? extends Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
    return Collections.singletonList(Maps.immutableEntry(UUID.class, this));
}
项目:simple-xml-serializers    文件:IntegerArrayTransform.java   
@Override
public Iterable<? extends Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
    return Collections.singleton(Maps.immutableEntry(int[].class, this));
}
项目:simple-xml-serializers    文件:SerializableTransform.java   
@Override
public Iterable<? extends Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
    return Collections.singleton(Maps.immutableEntry(Serializable.class, this));
}
项目:simple-xml-serializers    文件:URITransform.java   
@Override
@SuppressWarnings("unchecked")  // Generic array creation
public Iterable<? extends Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
    return Collections.singletonList(Maps.immutableEntry(URI.class, this));
}
项目:simple-xml-serializers    文件:CharsetTransform.java   
@Override
public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
    return Collections.singleton(Maps.immutableEntry(Charset.class, this));
}
项目:simple-xml-serializers    文件:ByteArrayTransform.java   
@Override
public Iterable<? extends Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms() {
    return Collections.singleton(Maps.immutableEntry(byte[].class, this));
}
项目:simple-xml-serializers    文件:TransformFactory.java   
@Nonnull
public Iterable<? extends Entry<? extends Class<?>, ? extends Transform<?>>> newTransforms();
项目:simplexml    文件:LiteralTest.java   
public Transform match(Class type) {
   if(type == Literal.class) {
      return new LiteralTransform();
   }
   return null;
}
项目:simplexml    文件:MatcherTest.java   
public Transform match(Class type) throws Exception {
   if(type == Integer.class) {
      return this;
   }
   return null;
}
项目:simplexml    文件:MatcherTest.java   
public Transform match(Class type) throws Exception {
   if(type == String.class) {
      return this;
   }
   return null;
}
项目:simplexml    文件:MatcherTest.java   
public Transform match(Class type) throws Exception {
   if(type == MyEnum.class) {
      return this;
   }
   return null;
}
项目:simplexml    文件:TextConstructorInjectionWithTransformTest.java   
public Transform match(Class type) throws Exception {
   if(type == DateTime.class) {
      return new DateTimeTransform();
   }
   return null;
}
项目:simple-xml    文件:LiteralTest.java   
public Transform match(Class type) {
   if(type == Literal.class) {
      return new LiteralTransform();
   }
   return null;
}
项目:simple-xml    文件:MatcherTest.java   
public Transform match(Class type) throws Exception {
   if(type == Integer.class) {
      return this;
   }
   return null;
}
项目:simple-xml    文件:MatcherTest.java   
public Transform match(Class type) throws Exception {
   if(type == String.class) {
      return this;
   }
   return null;
}
项目:simple-xml    文件:MatcherTest.java   
public Transform match(Class type) throws Exception {
   if(type == MyEnum.class) {
      return this;
   }
   return null;
}
项目:simple-xml    文件:TextConstructorInjectionWithTransformTest.java   
public Transform match(Class type) throws Exception {
   if(type == DateTime.class) {
      return new DateTimeTransform();
   }
   return null;
}
项目:angerona-framework    文件:SerializeHelper.java   
public void addTransformMapping(Class<?> dataCls, Class<? extends Transform<?>> transformCls) {
    matcher.bind(dataCls, transformCls);
    LOG.info("Registered Transform '{}' for '{}'.", transformCls.getSimpleName(), 
            dataCls.getSimpleName());
}
项目:angerona-framework    文件:AngeronaPluginAdapter.java   
protected void addTransformMapping(Class<?> dataCls, Class<? extends Transform<?>> transformCls) {
    SerializeHelper.get().addTransformMapping(dataCls, transformCls);
    matcherMap.put(dataCls, transformCls);
}
项目:simplexml    文件:Support.java   
/**
 * This is used to match a <code>Transform</code> using the type
 * specified. If no transform can be acquired then this returns
 * a null value indicating that no transform could be found.
 * 
 * @param type this is the type to acquire the transform for
 * 
 * @return returns a transform for processing the type given
 */ 
public Transform getTransform(Class type) throws Exception {
   return matcher.match(type);
}
项目:simplexml    文件:EmptyMatcher.java   
/**
 * This method is used to return a null value for the transform.
 * Returning a null value allows the normal resolution of the
 * stock transforms to be used when no matcher is specified.
 * 
 * @param type this is the type that is expecting a transform
 * 
 * @return this transform will always return a null value
 */
public Transform match(Class type) throws Exception {
   return null;
}
项目:simple-xml    文件:Support.java   
/**
 * This is used to match a <code>Transform</code> using the type
 * specified. If no transform can be acquired then this returns
 * a null value indicating that no transform could be found.
 * 
 * @param type this is the type to acquire the transform for
 * 
 * @return returns a transform for processing the type given
 */ 
public Transform getTransform(Class type) throws Exception {
   return matcher.match(type);
}