org.hibernate.type.descriptor.java.DataHelper Java Examples

The following examples show how to use org.hibernate.type.descriptor.java.DataHelper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlobProxy.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public byte[] getBytes() {
	if ( bytes == null ) {
		bytes = DataHelper.extractBytes( stream );
	}
	return bytes;
}
 
Example #2
Source File: CharacterStreamImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String asString() {
	if ( string == null ) {
		string = DataHelper.extractString( reader );
	}
	return string;
}
 
Example #3
Source File: JSONType.java    From spring-data-jpa-extra with Apache License 2.0 5 votes vote down vote up
private static String extractString(Object value) {
    if (value == null) {
        return null;
    }
    if (value instanceof String) {
        return (String) value;
    }
    if (value instanceof Reader) {
        return DataHelper.extractString((Reader) value);
    }
    if (value instanceof Clob) {
        return DataHelper.extractString((Clob) value);
    }
    return null;
}
 
Example #4
Source File: BufferedContentTypeDescriptor.java    From cosmo with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public <X> X unwrap(BufferedContent value, Class<X> type, WrapperOptions options) {
    if (value == null) {
        return null;
    }
    if (BufferedContent.class.isAssignableFrom(type)) {
        return (X) value;
    }
    if (BinaryStream.class.isAssignableFrom(type)) {
        return (X) new BinaryStreamImpl(DataHelper.extractBytes(value.getInputStream()));
    }
    throw unknownUnwrap(type);
}
 
Example #5
Source File: AbstractHANADialect.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public long position(Clob searchstr, long start) throws SQLException {
	return this.data.indexOf( DataHelper.extractString( searchstr ), (int) ( start - 1 ) );
}
 
Example #6
Source File: BeanTransformerAdapter.java    From spring-data-jpa-extra with Apache License 2.0 4 votes vote down vote up
@Override
public String convert(Clob source) {
    return DataHelper.extractString(source);
}
 
Example #7
Source File: BufferedContentTypeDescriptor.java    From cosmo with Apache License 2.0 4 votes vote down vote up
@Override
public String toString(BufferedContent value) {
    final byte[] bytes;
    bytes = DataHelper.extractBytes(value.getInputStream());
    return PrimitiveByteArrayTypeDescriptor.INSTANCE.toString(bytes);
}