本文整理汇总了Java中org.hibernate.util.StringHelper.isNotEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java StringHelper.isNotEmpty方法的具体用法?Java StringHelper.isNotEmpty怎么用?Java StringHelper.isNotEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.util.StringHelper
的用法示例。
在下文中一共展示了StringHelper.isNotEmpty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSQLExceptionConverter
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
/**
* Build a SQLExceptionConverter instance.
* <p/>
* First, looks for a {@link Environment.SQL_EXCEPTION_CONVERTER} property to see
* if the configuration specified the class of a specific converter to use. If this
* property is set, attempt to construct an instance of that class. If not set, or
* if construction fails, the converter specific to the dialect will be used.
*
* @param dialect The defined dialect.
* @param properties The configuration properties.
* @return An appropriate SQLExceptionConverter instance.
* @throws HibernateException There was an error building the SQLExceptionConverter.
*/
public static SQLExceptionConverter buildSQLExceptionConverter(Dialect dialect, Properties properties) throws HibernateException {
SQLExceptionConverter converter = null;
String converterClassName = ( String ) properties.get( Environment.SQL_EXCEPTION_CONVERTER );
if ( StringHelper.isNotEmpty( converterClassName ) ) {
converter = constructConverter( converterClassName, dialect.getViolatedConstraintNameExtracter() );
}
if ( converter == null ) {
log.trace( "Using dialect defined converter" );
converter = dialect.buildSQLExceptionConverter();
}
if ( converter instanceof Configurable ) {
try {
( ( Configurable ) converter ).configure( properties );
}
catch ( HibernateException e ) {
log.warn( "Unable to configure SQLExceptionConverter", e );
throw e;
}
}
return converter;
}
示例2: locatePersistentClassByEntityName
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public PersistentClass locatePersistentClassByEntityName(String entityName) {
PersistentClass persistentClass = ( PersistentClass ) classes.get( entityName );
if ( persistentClass == null ) {
String actualEntityName = ( String ) imports.get( entityName );
if ( StringHelper.isNotEmpty( actualEntityName ) ) {
persistentClass = ( PersistentClass ) classes.get( actualEntityName );
}
}
return persistentClass;
}
示例3: addCondition
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
/**
* Appends the 'on' condition to the buffer, returning true if the condition was added.
* Returns false if the 'on' condition was empty.
*
* @param buffer The buffer to append the 'on' condition to.
* @param on The 'on' condition.
* @return Returns true if the condition was added, false if the condition was already in 'on' string.
*/
protected boolean addCondition(StringBuffer buffer, String on) {
if ( StringHelper.isNotEmpty( on ) ) {
if ( !on.startsWith( " and" ) ) buffer.append( " and " );
buffer.append( on );
return true;
}
else {
return false;
}
}
示例4: setText
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public void setText(String s) {
// for some reason the antlr.CommonAST initialization routines force
// this method to get called twice. The first time with an empty string
if ( StringHelper.isNotEmpty( s ) ) {
constantExpression = s;
constantValue = ReflectHelper.getConstantValue( s );
heuristicType = TypeFactory.heuristicType( constantValue.getClass().getName() );
super.setText( s );
}
}
示例5: addJoinNodes
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement, boolean inSubquery) {
// Generate FROM and WHERE fragments for the from element.
JoinFragment joinFragment = join.toJoinFragment(
inSubquery ? Collections.EMPTY_MAP : queryTranslatorImpl.getEnabledFilters(),
fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
fromElement.getWithClauseFragment(),
fromElement.getWithClauseJoinAlias()
);
String frag = joinFragment.toFromFragmentString();
String whereFrag = joinFragment.toWhereFragmentString();
// If the from element represents a JOIN_FRAGMENT and it is
// a theta-style join, convert its type from JOIN_FRAGMENT
// to FROM_FRAGMENT
if ( fromElement.getType() == JOIN_FRAGMENT &&
( join.isThetaStyle() || StringHelper.isNotEmpty( whereFrag ) ) ) {
fromElement.setType( FROM_FRAGMENT );
fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
}
// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) {
String fromFragment = processFromFragment( frag, join );
if ( log.isDebugEnabled() ) {
log.debug( "Using FROM fragment [" + fromFragment + "]" );
}
fromElement.setText( fromFragment.trim() ); // Set the text of the fromElement.
}
andFactory.addWhereFragment( joinFragment, whereFrag, query, fromElement );
}
示例6: doSecondPass
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
public void doSecondPass(Map persistentClasses) throws MappingException {
String queryName = queryElem.attribute( "name" ).getValue();
if (path!=null) queryName = path + '.' + queryName;
boolean cacheable = "true".equals( queryElem.attributeValue( "cacheable" ) );
String region = queryElem.attributeValue( "cache-region" );
Attribute tAtt = queryElem.attribute( "timeout" );
Integer timeout = tAtt == null ? null : new Integer( tAtt.getValue() );
Attribute fsAtt = queryElem.attribute( "fetch-size" );
Integer fetchSize = fsAtt == null ? null : new Integer( fsAtt.getValue() );
Attribute roAttr = queryElem.attribute( "read-only" );
boolean readOnly = roAttr != null && "true".equals( roAttr.getValue() );
Attribute cacheModeAtt = queryElem.attribute( "cache-mode" );
String cacheMode = cacheModeAtt == null ? null : cacheModeAtt.getValue();
Attribute cmAtt = queryElem.attribute( "comment" );
String comment = cmAtt == null ? null : cmAtt.getValue();
java.util.List synchronizedTables = new ArrayList();
Iterator tables = queryElem.elementIterator( "synchronize" );
while ( tables.hasNext() ) {
synchronizedTables.add( ( (Element) tables.next() ).attributeValue( "table" ) );
}
boolean callable = "true".equals( queryElem.attributeValue( "callable" ) );
NamedSQLQueryDefinition namedQuery;
Attribute ref = queryElem.attribute( "resultset-ref" );
String resultSetRef = ref == null ? null : ref.getValue();
if ( StringHelper.isNotEmpty( resultSetRef ) ) {
namedQuery = new NamedSQLQueryDefinition(
queryElem.getText(),
resultSetRef,
synchronizedTables,
cacheable,
region,
timeout,
fetchSize,
HbmBinder.getFlushMode( queryElem.attributeValue( "flush-mode" ) ),
HbmBinder.getCacheMode( cacheMode ),
readOnly,
comment,
HbmBinder.getParameterTypes( queryElem ),
callable
);
//TODO check there is no actual definition elemnents when a ref is defined
}
else {
ResultSetMappingDefinition definition = buildResultSetMappingDefinition( queryElem, path, mappings );
namedQuery = new NamedSQLQueryDefinition(
queryElem.getText(),
definition.getQueryReturns(),
synchronizedTables,
cacheable,
region,
timeout,
fetchSize,
HbmBinder.getFlushMode( queryElem.attributeValue( "flush-mode" ) ),
HbmBinder.getCacheMode( cacheMode ),
readOnly,
comment,
HbmBinder.getParameterTypes( queryElem ),
callable
);
}
log.debug( "Named SQL query: " + queryName + " -> " + namedQuery.getQueryString() );
mappings.addSQLQuery( queryName, namedQuery );
}
示例7: logicalColumnName
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
/**
* Return the column name or the unqualified property name
*/
public String logicalColumnName(String columnName, String propertyName) {
return StringHelper.isNotEmpty( columnName ) ? columnName : StringHelper.unqualify( propertyName );
}
示例8: logicalCollectionColumnName
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
/**
* Return the column name if explicit or the concatenation of the property name and the referenced column
*/
public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) {
return StringHelper.isNotEmpty( columnName ) ?
columnName :
StringHelper.unqualify( propertyName ) + "_" + referencedColumn;
}
示例9: toStatementString
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
/**
* Construct an SQL <tt>SELECT</tt> statement from the given clauses
*/
public String toStatementString() {
StringBuffer buf = new StringBuffer(guesstimatedBufferSize);
if ( StringHelper.isNotEmpty(comment) ) {
buf.append("/* ").append(comment).append(" */ ");
}
buf.append("select ").append(selectClause)
.append(" from ").append(fromClause);
if ( StringHelper.isNotEmpty(outerJoinsAfterFrom) ) {
buf.append(outerJoinsAfterFrom);
}
if ( StringHelper.isNotEmpty(whereClause) || StringHelper.isNotEmpty(outerJoinsAfterWhere) ) {
buf.append(" where " );
// the outerJoinsAfterWhere needs to come before where clause to properly
// handle dynamic filters
if ( StringHelper.isNotEmpty(outerJoinsAfterWhere) ) {
buf.append(outerJoinsAfterWhere);
if ( StringHelper.isNotEmpty(whereClause) ) {
buf.append( " and " );
}
}
if ( StringHelper.isNotEmpty(whereClause) ) {
buf.append(whereClause);
}
}
if ( StringHelper.isNotEmpty(groupByClause) ) {
buf.append(" group by ").append(groupByClause);
}
if ( StringHelper.isNotEmpty(orderByClause) ) {
buf.append(" order by ").append(orderByClause);
}
if (lockMode!=null) {
buf.append( dialect.getForUpdateString(lockMode) );
}
return dialect.transformSelectString( buf.toString() );
}
示例10: logicalCollectionColumnName
import org.hibernate.util.StringHelper; //导入方法依赖的package包/类
/**
* Return the column name if explicit or the concatenation of the property name and the referenced column
*
*/
public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) {
return StringHelper.isNotEmpty( columnName ) ? columnName : propertyName + "_" + referencedColumn;
}