/** * @param key * the key. * @return key value, never null. */ public KeyValue<?> getRequired( final String key ) { final KeyValue<?> keyValue = this.get( key ); if ( keyValue == null ) { throw new IllegalArgumentException( "Entry not found [key=" + key + "]" ); } return keyValue; }
/** * {@inheritDoc} * * @see java.lang.Iterable#iterator() */ public Iterator<KeyValue<?>> iterator() { return this.keyValues().iterator(); }
/** * {@inheritDoc} * * @see java.lang.Object#toString() */ @Override public String toString() { final ToStringBuilder builder = new ToStringBuilder( this, ToStringStyle.SHORT_PREFIX_STYLE ); builder.append( "size", this.size() ); return builder.toString(); }
/** * Walk entries. * * @param handler * handler to call. * @throws IllegalArgumentException * if handler is null. */ public void walk( final Closure handler ) throws IllegalArgumentException { this.walk( handler, TruePredicate.INSTANCE ); }
/** * @param key * key to set. * @return new string property. * @throws IllegalArgumentException * if key is invalid. */ public StringPluginProperty createString( final String key ) throws IllegalArgumentException { final StringPluginProperty property = new StringPluginProperty( key ); this.properties.add( property ); return property; }
/** * @param filter * filter to use. * @return matching key values. * @throws IllegalArgumentException * if filter is null. */ public List<KeyValue<?>> get( final Predicate filter ) throws IllegalArgumentException { final AddClosureArrayList<KeyValue<?>> result = new AddClosureArrayList<KeyValue<?>>(); this.walk( result, filter ); return result; }
/** * @param key * key to set. * @return new integer property. * @throws IllegalArgumentException * if key is invalid. */ public IntegerPluginProperty createInteger( final String key ) throws IllegalArgumentException { final IntegerPluginProperty property = new IntegerPluginProperty( key ); this.properties.add( property ); return property; }
/** * Read properties from preferences. */ public void readFromPreferences() { final Preferences node = Preferences.userNodeForPackage( this.getClass() ); this.getProperties().walk( new ReadFromPreferences( node ) ); }
/** * @param key * key to set. * @return new boolean property. * @throws IllegalArgumentException * if key is invalid. */ public BooleanPluginProperty createBoolean( final String key ) throws IllegalArgumentException { final BooleanPluginProperty property = new BooleanPluginProperty( key ); this.properties.add( property ); return property; }
/** * @param properties * properties. * @param handler * handler. * @throws KettleException * ... * @throws IllegalArgumentException * if properties is null. */ public static void walk( final KeyValueSet properties, final Closure handler ) throws KettleException, IllegalArgumentException { assertProperties( properties ); try { properties.walk( handler ); } catch ( FunctorException e ) { throw (KettleException) e.getCause(); } }
/** * @param key * key. * @return new string list. * @throws IllegalArgumentException * if key is invalid. */ public StringListPluginProperty createStringList( final String key ) throws IllegalArgumentException { final StringListPluginProperty property = new StringListPluginProperty( key ); this.properties.add( property ); return property; } }
/** * Saves properties to preferences. * * @throws BackingStoreException * ... */ public void saveAsPreferences() throws BackingStoreException { final Preferences node = Preferences.userNodeForPackage( this.getClass() ); this.getProperties().walk( new SaveToPreferences( node ) ); node.flush(); }
/** * {@inheritDoc} * * @see org.pentaho.di.trans.step.StepMetaInterface#loadXML(org.w3c.dom.Node, java.util.List, java.util.Map) */ public void loadXML( final Node node, final List<DatabaseMeta> databaseMeta, final IMetaStore metaStore ) throws KettleXMLException { this.getProperties().walk( new LoadXml( node ) ); initDbMeta( databaseMeta ); }
/** * @param properties * properties * @return XML String * @throws IllegalArgumentException * if properties is null */ public static String toXml( final KeyValueSet properties ) throws IllegalArgumentException { assertProperties( properties ); final AppendXml handler = new AppendXml(); properties.walk( handler ); return handler.getXml(); }