类org.hibernate.collection.internal.PersistentSet源码实例Demo

下面列出了怎么用org.hibernate.collection.internal.PersistentSet的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dhis2-core   文件: HibernateUtils.java
/**
 * If object is proxy, get unwrapped non-proxy object.
 *
 * @param proxy Object to check and unwrap
 * @return Unwrapped object if proxyied, if not just returns same object
 */
@SuppressWarnings( "unchecked" )
public static <T> T unwrap( T proxy )
{
    if ( !isProxy( proxy ) )
    {
        return proxy;
    }

    Hibernate.initialize( proxy );

    if ( HibernateProxy.class.isInstance( proxy ) )
    {
        Object result = ((HibernateProxy) proxy).writeReplace();

        if ( !SerializableProxy.class.isInstance( result ) )
        {
            return (T) result;
        }
    }

    if ( PersistentCollection.class.isInstance( proxy ) )
    {
        PersistentCollection persistentCollection = (PersistentCollection) proxy;

        if ( PersistentSet.class.isInstance( persistentCollection ) )
        {
            Map<?, ?> map = (Map<?, ?>) persistentCollection.getStoredSnapshot();
            return (T) new LinkedHashSet<>( map.keySet() );
        }

        return (T) persistentCollection.getStoredSnapshot();
    }

    return proxy;
}
 
源代码2 项目: lams   文件: SetType.java
@Override
public PersistentCollection instantiate(SharedSessionContractImplementor session, CollectionPersister persister, Serializable key) {
	return new PersistentSet( session );
}
 
源代码3 项目: lams   文件: SetType.java
@Override
public PersistentCollection wrap(SharedSessionContractImplementor session, Object collection) {
	return new PersistentSet( session, (java.util.Set) collection );
}
 
@Override
public boolean canConvert(final Class type) {
    return PersistentBag.class == type || PersistentList.class == type || PersistentSet.class == type;
}
 
 类所在包
 类方法
 同包方法