Java 类org.hibernate.internal.util.SerializationHelper 实例源码

项目:lams    文件:Configuration.java   
/**
 * <b>INTENDED FOR TESTSUITE USE ONLY!</b>
 * <p/>
 * Much like {@link #addCacheableFile(File)} except that here we will fail immediately if
 * the cache version cannot be found or used for whatever reason
 *
 * @param xmlFile The xml file, not the bin!
 *
 * @return The dom "deserialized" from the cached file.
 *
 * @throws SerializationException Indicates a problem deserializing the cached dom tree
 * @throws FileNotFoundException Indicates that the cached file was not found or was not usable.
 */
public Configuration addCacheableFileStrictly(File xmlFile) throws SerializationException, FileNotFoundException {
    final File cachedFile = determineCachedDomFile( xmlFile );

    final boolean useCachedFile = xmlFile.exists()
            && cachedFile.exists()
            && xmlFile.lastModified() < cachedFile.lastModified();

    if ( ! useCachedFile ) {
        throw new FileNotFoundException( "Cached file could not be found or could not be used" );
    }

    LOG.readingCachedMappings( cachedFile );
    Document document = ( Document ) SerializationHelper.deserialize( new FileInputStream( cachedFile ) );
    add( new XmlDocumentImpl( document, "file", xmlFile.getAbsolutePath() ) );
    return this;
}
项目:hibernate-semantic-query    文件:SerializableJavaDescriptor.java   
@SuppressWarnings({ "unchecked" })
protected T fromBytes(byte[] bytes) {
    if ( getJavaType() == null ) {
        throw new IllegalStateException( "Cannot read bytes for Serializable type" );
    }

    return (T) SerializationHelper.deserialize( bytes, getJavaType().getClassLoader() );
}
项目:lams    文件:SerializableTypeDescriptor.java   
@Override
      @SuppressWarnings({ "unchecked" })
public S deepCopyNotNull(S value) {
    return (S) SerializationHelper.clone( value );
}
项目:lams    文件:SerializableTypeDescriptor.java   
protected byte[] toBytes(T value) {
    return SerializationHelper.serialize( value );
}
项目:lams    文件:SerializableTypeDescriptor.java   
@SuppressWarnings({ "unchecked" })
protected T fromBytes(byte[] bytes) {
    return (T) SerializationHelper.deserialize( bytes, getJavaTypeClass().getClassLoader() );
}
项目:hibernate-types    文件:JacksonUtil.java   
public static <T> T clone(T value) {
    return (value instanceof Serializable) ?
        (T) SerializationHelper.clone((Serializable) value) :
            fromString(toString(value), (Class<T>) value.getClass());
}
项目:hibernate-types    文件:JacksonUtil.java   
public static <T> T clone(T value) {
    return (value instanceof Serializable) ?
            (T) SerializationHelper.clone((Serializable) value) :
            fromString(toString(value), (Class<T>) value.getClass());
}
项目:hibernate-types    文件:JacksonUtil.java   
public static <T> T clone(T value) {
    return (value instanceof Serializable) ?
            (T) SerializationHelper.clone((Serializable) value) :
            fromString(toString(value), (Class<T>) value.getClass());
}
项目:hibernate-types    文件:JacksonUtil.java   
public static <T> T clone(T value) {
    return (value instanceof Serializable) ?
            (T) SerializationHelper.clone((Serializable) value) :
            fromString(toString(value), (Class<T>) value.getClass());
}
项目:flux    文件:ListJsonType.java   
/** Performs deep copy of an object using serialization and de-serialization*/
@Override
public Object deepCopy(Object value) throws HibernateException {
    return SerializationHelper.clone((Serializable) value);
}
项目:hibernate-semantic-query    文件:SerializableJavaDescriptor.java   
@Override
@SuppressWarnings({ "unchecked" })
public S deepCopyNotNull(S value) {
    return (S) SerializationHelper.clone( value );
}
项目:hibernate-semantic-query    文件:SerializableJavaDescriptor.java   
protected byte[] toBytes(T value) {
    return SerializationHelper.serialize( value );
}