public static String[] split(String separators, String list) { return split( separators, list, false ); }
/** * Convert a string to an array of strings. The assumption is that * the individual array elements are delimited in the source stringForm * param by the delim param. * * @param stringForm The string form of the string array. * @param delim The delimiter used to separate individual array elements. * @return The array; never null, though may be empty. */ public static String[] toStringArray(String stringForm, String delim) { // todo : move to StringHelper? if ( stringForm != null ) { return StringHelper.split( delim, stringForm ); } else { return ArrayHelper.EMPTY_STRING_ARRAY; } }
private static class JpaEntityNotFoundDelegate implements EntityNotFoundDelegate, Serializable { /** * Singleton access */ public static final JpaEntityNotFoundDelegate INSTANCE = new JpaEntityNotFoundDelegate(); public void handleEntityNotFound(String entityName, Serializable id) { throw new EntityNotFoundException( "Unable to find " + entityName + " with id " + id ); } }
private ArrayList<MetadataSourceType> resolveInitialSourceProcessOrdering(ConfigurationService configService) { final ArrayList<MetadataSourceType> initialSelections = new ArrayList<>(); final String sourceProcessOrderingSetting = configService.getSetting( AvailableSettings.ARTIFACT_PROCESSING_ORDER, StandardConverters.STRING ); if ( sourceProcessOrderingSetting != null ) { final String[] orderChoices = StringHelper.split( ",; ", sourceProcessOrderingSetting, false ); initialSelections.addAll( CollectionHelper.arrayList( orderChoices.length ) ); for ( String orderChoice : orderChoices ) { initialSelections.add( MetadataSourceType.parsePrecedence( orderChoice ) ); } } if ( initialSelections.isEmpty() ) { initialSelections.add( MetadataSourceType.HBM ); initialSelections.add( MetadataSourceType.CLASS ); } return initialSelections; }
tableList = params.getProperty( PersistentIdentifierGenerator.TABLES ); String[] tables = StringHelper.split( ", ", tableList );
private void applyCustomerResolvers( DialectResolverSet resolver, ServiceRegistryImplementor registry, Map configurationValues) { final String resolverImplNames = (String) configurationValues.get( AvailableSettings.DIALECT_RESOLVERS ); if ( StringHelper.isNotEmpty( resolverImplNames ) ) { final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class ); for ( String resolverImplName : StringHelper.split( ", \n\r\f\t", resolverImplNames ) ) { try { resolver.addResolver( (DialectResolver) classLoaderService.classForName( resolverImplName ).newInstance() ); } catch (HibernateException e) { throw e; } catch (Exception e) { throw new ServiceException( "Unable to instantiate named dialect resolver [" + resolverImplName + "]", e ); } } } } }
nodeText = nodeText.substring( 0, nodeText.length() - 1 ); String[] splits = StringHelper.split( ", ", nodeText ); if ( count != splits.length ) { throw new HibernateException( "SqlNode's text did not reference expected number of columns" );
String[] tokens = StringHelper.split( StringHelper.WHITESPACE + "(),", query, true ); if ( tokens.length == 0 ) {
nodeText = nodeText.substring( 0, nodeText.length() - 1 ); String[] splits = StringHelper.split( ", ", nodeText ); if ( count != splits.length ) { throw new HibernateException( "SqlNode's text did not reference expected number of columns" );
private void preprocess(String token, QueryTranslatorImpl q) throws QueryException { // ugly hack for cases like "elements(foo.bar.collection)" // (multi-part path expression ending in elements or indices) String[] tokens = StringHelper.split( ".", token, true ); if ( tokens.length > 5 && ( CollectionPropertyNames.COLLECTION_ELEMENTS.equals( tokens[tokens.length - 1] ) || CollectionPropertyNames.COLLECTION_INDICES.equals( tokens[tokens.length - 1] ) ) ) { pathExpressionParser.start( q ); for ( int i = 0; i < tokens.length - 3; i++ ) { pathExpressionParser.token( tokens[i], q ); } pathExpressionParser.token( null, q ); pathExpressionParser.end( q ); addJoin( pathExpressionParser.getWhereJoin(), q ); pathExpressionParser.ignoreInitialJoin(); } }
/** * Turns a path into an AST. * * @param path The path. * @param factory The AST factory to use. * @return An HQL AST representing the path. */ public static AST parsePath(String path, ASTFactory factory) { String[] identifiers = StringHelper.split( ".", path ); AST lhs = null; for ( int i = 0; i < identifiers.length; i++ ) { String identifier = identifiers[i]; AST child = ASTUtil.create( factory, HqlSqlTokenTypes.IDENT, identifier ); if ( i == 0 ) { lhs = child; } else { lhs = ASTUtil.createBinarySubtree( factory, HqlSqlTokenTypes.DOT, ".", lhs, child ); } } if ( LOG.isDebugEnabled() ) { LOG.debugf( "parsePath() : %s -> %s", path, ASTUtil.getDebugString( lhs ) ); } return lhs; }
System.out.println(dateStr1 + '=' + dateStr2); if ( ! ( getDialect() instanceof Oracle8iDialect ) ) { //Oracle renders the name of the month :( String[] dp1 = StringHelper.split("-", dateStr1); String[] dp2 = StringHelper.split( "-", dateStr2 ); for (int i=0; i<3; i++) { if ( dp1[i].startsWith( "0" ) ) {
public static String[] split(String seperators, String list) { return split( seperators, list, false ); }
public boolean isSequence(Object key) { if (key instanceof String){ String[] strings = StringHelper.split(".", (String) key); return sequences.contains( strings[strings.length-1].toLowerCase()); } return false; }
public boolean isSequence(Object key) { if (key instanceof String){ String[] strings = StringHelper.split(".", (String) key); return sequences.contains( strings[strings.length-1].toLowerCase()); } return false; }
@Override public boolean isSequence(Object key) { if (key instanceof String) { String[] strings = StringHelper.split(".", (String) key); return sequences.contains(strings[strings.length - 1].toLowerCase()); } return false; }
private static String getColumnSqlTypeFromColumnDefinition(String sqlType) { if ( !StringTools.isEmpty( sqlType ) ) { String[] tokens = StringHelper.split( " ", sqlType ); if ( tokens.length >= 1 ) { return tokens[0]; } } return null; }
private static class JpaEntityNotFoundDelegate implements EntityNotFoundDelegate, Serializable { /** * Singleton access */ public static final JpaEntityNotFoundDelegate INSTANCE = new JpaEntityNotFoundDelegate(); public void handleEntityNotFound(String entityName, Object id) { throw new EntityNotFoundException( "Unable to find " + entityName + " with id " + id ); } }
public static Iterable<CascadeStyle> interpretCascadeStyles(String cascades, LocalBindingContext bindingContext) { final Set<CascadeStyle> cascadeStyles = new HashSet<CascadeStyle>(); if ( StringHelper.isEmpty( cascades ) ) { cascades = bindingContext.getMappingDefaults().getCascadeStyle(); } for ( String cascade : StringHelper.split( ",", cascades ) ) { cascadeStyles.add( CascadeStyle.getCascadeStyle( cascade ) ); } return cascadeStyles; }
public static Iterable<CascadeStyle> interpretCascadeStyles(String cascades, LocalBindingContext bindingContext) { final Set<CascadeStyle> cascadeStyles = new HashSet<CascadeStyle>(); if ( StringHelper.isEmpty( cascades ) ) { cascades = bindingContext.getMappingDefaults().getCascadeStyle(); } for ( String cascade : StringHelper.split( ",", cascades ) ) { cascadeStyles.add( CascadeStyle.getCascadeStyle( cascade ) ); } return cascadeStyles; }