public static String[] toStringArray(String property, String delim, Properties properties) { return toStringArray( properties.getProperty(property), delim ); }
public static String[] toStringArray(String property, String delim, Properties properties) { return toStringArray( properties.getProperty(property), delim ); }
public void setCustomListenersAsString(String customListenersString) { // Note : expected in the syntax: // type=listenerClass // ({sep}type=listenerClass)* // where {sep} is any whitespace or comma if ( StringHelper.isNotEmpty( customListenersString) ) { String[] listenerEntries = PropertiesHelper.toStringArray( customListenersString, " ,\n\t\r\f" ); for ( int i = 0; i < listenerEntries.length; i++ ) { final int keyValueSepPosition = listenerEntries[i].indexOf( '=' ); final String type = listenerEntries[i].substring( 0, keyValueSepPosition ); final String listenerClass = listenerEntries[i].substring( keyValueSepPosition + 1 ); setCustomListener( type, listenerClass ); } } }
public void setCustomListenersAsString(String customListenersString) { // Note : expected in the syntax: // type=listenerClass // ({sep}type=listenerClass)* // where {sep} is any whitespace or comma if ( StringHelper.isNotEmpty( customListenersString) ) { String[] listenerEntries = PropertiesHelper.toStringArray( customListenersString, " ,\n\t\r\f" ); for ( int i = 0; i < listenerEntries.length; i++ ) { final int keyValueSepPosition = listenerEntries[i].indexOf( '=' ); final String type = listenerEntries[i].substring( 0, keyValueSepPosition ); final String listenerClass = listenerEntries[i].substring( keyValueSepPosition + 1 ); setCustomListener( type, listenerClass ); } } }
protected final Configuration buildConfiguration() { Configuration cfg = new Configuration().setProperties( buildProperties() ); String[] mappingFiles = PropertiesHelper.toStringArray( mapResources, " ,\n\t\r\f" ); for ( int i = 0; i < mappingFiles.length; i++ ) { cfg.addResource( mappingFiles[i] ); } if ( customListeners != null && !customListeners.isEmpty() ) { Iterator entries = customListeners.entrySet().iterator(); while ( entries.hasNext() ) { final Map.Entry entry = ( Map.Entry ) entries.next(); final String type = ( String ) entry.getKey(); final Object value = entry.getValue(); if ( value != null ) { if ( String.class.isAssignableFrom( value.getClass() ) ) { // Its the listener class name cfg.setListener( type, ( ( String ) value ) ); } else { // Its the listener instance (or better be) cfg.setListener( type, value ); } } } } return cfg; }
protected final Configuration buildConfiguration() { Configuration cfg = new Configuration().setProperties( buildProperties() ); String[] mappingFiles = PropertiesHelper.toStringArray( mapResources, " ,\n\t\r\f" ); for ( int i = 0; i < mappingFiles.length; i++ ) { cfg.addResource( mappingFiles[i] ); } if ( customListeners != null && !customListeners.isEmpty() ) { Iterator entries = customListeners.entrySet().iterator(); while ( entries.hasNext() ) { final Map.Entry entry = ( Map.Entry ) entries.next(); final String type = ( String ) entry.getKey(); final Object value = entry.getValue(); if ( value != null ) { if ( String.class.isAssignableFrom( value.getClass() ) ) { // Its the listener class name cfg.setListener( type, ( ( String ) value ) ); } else { // Its the listener instance (or better be) cfg.setListener( type, value ); } } } } return cfg; }