Examples of ISerializer


Examples of org.sf.bee.commons.remoting.jrpc.serializer.ISerializer

     * @throws Exception If a serialiser has already been registered for a class.
     */
    public void registerSerializer(final ISerializer s) throws Exception {
        final Logger logger = this.getLogger();
        Class classes[] = s.getSerializableClasses();
        ISerializer exists;
        synchronized (_serializerSet) {
            if (_serializableMap == null) {
                _serializableMap = new HashMap<Class, ISerializer>();
            }
            for (int i = 0; i < classes.length; i++) {
                exists = _serializableMap.get(classes[i]);
                if (exists != null && exists.getClass() != s.getClass()) {
                    throw new Exception("different serializer already registered for " + classes[i].getName());
                }
            }
            if (!_serializerSet.contains(s)) {
                if (logger.isLoggable(Level.FINE)) {
View Full Code Here

Examples of org.sf.bee.commons.remoting.jrpc.serializer.ISerializer

            }

            throw new UnmarshallException("can't assign null primitive");

        }
        ISerializer s = getSerializer(clazz, json.getClass());
        if (s != null) {
            return s.tryUnmarshall(state, clazz, json);
        }
        // As a last resort, we check if the object is in fact an instance of the
        // desired class. This will typically happen when the parameter is of
        // type java.lang.Object and the passed object is a String or an Integer
        // that is passed verbatim by JSON
View Full Code Here

Examples of org.sf.bee.commons.remoting.jrpc.serializer.ISerializer

            }

            throw new UnmarshallException("can't assign null primitive");
        }
        final Class jsonClass = json.getClass();
        final ISerializer s = this.getSerializer(clazz, jsonClass);
        if (s != null) {
            return s.unmarshall(state, clazz, json);
        }

        // As a last resort, we check if the object is in fact an instance of the
        // desired class. This will typically happen when the parameter is of
        // type java.lang.Object and the passed object is a String or an Integer
View Full Code Here

Examples of org.sf.bee.commons.remoting.jrpc.serializer.ISerializer

                    new Object[]{clazz == null ? "null" : clazz.getName(),
                        jsoClazz == null ? "null" : jsoClazz.getName()});
        }

        synchronized (_serializerSet) {
            ISerializer s = (ISerializer) _serializableMap.get(clazz);
            if (s != null && s.canSerialize(clazz, jsoClazz)) {
                if (logger.isLoggable(Level.FINE)) {
                    logger.log(Level.FINE, "direct match serializer {0}",
                            s.getClass().getName());
                }
                return s;
            }
            final Iterator i = _serializerList.iterator();
            while (i.hasNext()) {
                s = (ISerializer) i.next();
                if (s.canSerialize(clazz, jsoClazz)) {
                    if (logger.isLoggable(Level.FINE)) {
                        logger.log(Level.FINE, "search found serializer {0}",
                                s.getClass().getName());
                    }
                    return s;
                }
            }
        }
View Full Code Here

Examples of org.sf.bee.commons.remoting.jrpc.serializer.ISerializer

            throws IOException, ClassNotFoundException {
        in.defaultReadObject();
        _serializableMap = new HashMap();
        Iterator i = _serializerList.iterator();
        while (i.hasNext()) {
            ISerializer s = (ISerializer) i.next();
            Class classes[] = s.getSerializableClasses();
            for (int j = 0; j < classes.length; j++) {
                _serializableMap.put(classes[j], s);
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.