Java Code Examples for org.hibernate.annotations.common.util.StringHelper#isEmpty()

The following examples show how to use org.hibernate.annotations.common.util.StringHelper#isEmpty() . 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: InFlightMetadataCollectorImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void addTypeDefinition(TypeDefinition typeDefinition) {
	if ( typeDefinition == null ) {
		throw new IllegalArgumentException( "Type definition is null" );
	}

	// Need to register both by name and registration keys.
	if ( !StringHelper.isEmpty( typeDefinition.getName() ) ) {
		addTypeDefinition( typeDefinition.getName(), typeDefinition );
	}

	if ( typeDefinition.getRegistrationKeys() != null ) {
		for ( String registrationKey : typeDefinition.getRegistrationKeys() ) {
			addTypeDefinition( registrationKey, typeDefinition );
		}
	}
}
 
Example 2
Source File: Constraint.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public String sqlCreateString(Dialect dialect, Mapping p, String defaultCatalog, String defaultSchema) {
	if ( isGenerated( dialect ) ) {
		// Certain dialects (ex: HANA) don't support FKs as expected, but other constraints can still be created.
		// If that's the case, hasAlterTable() will be true, but getAddForeignKeyConstraintString will return
		// empty string.  Prevent blank "alter table" statements.
		String constraintString = sqlConstraintString( dialect, getName(), defaultCatalog, defaultSchema );
		if ( !StringHelper.isEmpty( constraintString ) ) {
			final String tableName = getTable().getQualifiedName( dialect, defaultCatalog, defaultSchema );
			return dialect.getAlterTableString( tableName ) + " " + constraintString;
		}
	}
	return null;
}
 
Example 3
Source File: DialectFactoryImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("SimplifiableIfStatement")
private boolean isEmpty(Object dialectReference) {
	if ( dialectReference != null ) {
		// the referenced value is not null
		if ( dialectReference instanceof String ) {
			// if it is a String, it might still be empty though...
			return StringHelper.isEmpty( (String) dialectReference );
		}
		return false;
	}
	return true;
}
 
Example 4
Source File: WebDSLDateBridge.java    From webdsl with Apache License 2.0 5 votes vote down vote up
public Object stringToObject(String stringValue) {
    if ( StringHelper.isEmpty( stringValue ) ) return null;
    try {
        return DateTools.stringToDate( stringValue );
    }
    catch (ParseException e) {
        throw new SearchException( "Unable to parse into date: " + stringValue, e );
    }
}