Java 类org.hibernate.collection.internal.PersistentMap 实例源码

项目:dubbo-demo    文件:MyHibernateCollectionSerializer.java   
@Override
public void writeObject(Object obj,
        com.alibaba.com.caucho.hessian.io.AbstractHessianOutput out)
        throws IOException {
     boolean init = Hibernate.isInitialized(obj);
        if (init) {
            out.writeObject(obj);
            out.flush();
            return;
        }
        if (PersistentMap.class.isAssignableFrom(obj.getClass())) {
            //将没有初始化的Map序列化空的HashMap
            mapSerializer.writeObject(new HashMap<Object,Object>(), out);
        } else {
            //将没有初始化的List,Set等序列化为空的ArrayList
            collectionSeiralizer.writeObject(new ArrayList<Object>(), out);
        }
}
项目:dubbo-demo    文件:HibernateSerializer.java   
@Override
public void writeObject(Object obj, AbstractHessianOutput out) throws IOException {

    boolean init = Hibernate.isInitialized(obj);

    if (init) {
        out.writeObject(obj);
        out.flush();
        return;
    }

    if (PersistentMap.class.isAssignableFrom(obj.getClass())) {
        //将没有初始化的Map序列化空的HashMap
        mapSerializer.writeObject(new HashMap<Object,Object>(), out);
    } else {
        //将没有初始化的List,Set等序列化为空的ArrayList
        collectionSeiralizer.writeObject(new ArrayList<Object>(), out);
    }
}
项目:BLOG-Microservice    文件:HibernateSerializerFactory.java   
@SuppressWarnings("rawtypes")
public Serializer getSerializer(Class cl) throws HessianProtocolException {
    if (PersistentMap.class.isAssignableFrom(cl)) {
        return mapSerializer;
    } else if (AbstractPersistentCollection.class.isAssignableFrom(cl)) {
        return listSerializer;
    } else if (cl.getSimpleName().contains("_$$_javassist_")) {
        return hibernateBeanSerializer;
    }
    return super.getSerializer(cl);
}
项目:dubbo-demo    文件:MyHessian2SerializerFactory.java   
@SuppressWarnings("rawtypes")
@Override
public Serializer getSerializer(Class cl) throws HessianProtocolException{
    if (PersistentMap.class.isAssignableFrom(cl) || PersistentBag.class.isAssignableFrom(cl)) {
        return serializer ;
    }
    return super.getSerializer(cl);
}
项目:SlipStreamServer    文件:ConcurrentHashMapType.java   
@SuppressWarnings("unchecked")
public Iterator<T> getElementsIterator(Object collection) {
    try {
        return ((ConcurrentHashMap<V, T>) collection).values().iterator();
    } catch (ClassCastException cce) {
        return ((PersistentMap) collection).values().iterator();
    }
}
项目:lams    文件:MapType.java   
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
    return new PersistentMap(session);
}
项目:lams    文件:MapType.java   
public PersistentCollection wrap(SessionImplementor session, Object collection) {
    return new PersistentMap( session, (java.util.Map) collection );
}
项目:SlipStreamServer    文件:ConcurrentHashMapType.java   
public PersistentCollection instantiate(SessionImplementor session,
        CollectionPersister persister) {
    return new PersistentMap(session);
}
项目:SlipStreamServer    文件:ConcurrentHashMapType.java   
@SuppressWarnings("unchecked")
public PersistentCollection wrap(SessionImplementor session,
        Object collection) {
    return new PersistentMap(session, (ConcurrentHashMap<V, T>) collection);
}