/** * Creates a Transformer that will return the same object each time the * transformer is used. * * @see org.apache.commons.collections.functors.ConstantTransformer * * @param constantToReturn the constant object to return each time in the transformer * @return the transformer. */ public static Transformer constantTransformer(Object constantToReturn) { return ConstantTransformer.getInstance(constantToReturn); }
/** * Creates a Transformer that will return the same object each time the * transformer is used. * * @see org.apache.commons.collections.functors.ConstantTransformer * * @param constantToReturn the constant object to return each time in the transformer * @return the transformer. */ public static Transformer constantTransformer(Object constantToReturn) { return ConstantTransformer.getInstance(constantToReturn); }
/** * Constructs a new empty <code>DefaultedMap</code> that decorates * a <code>HashMap</code>. * <p> * The object passed in will be returned by the map whenever an * unknown key is requested. * * @param defaultValue the default value to return when the key is not found */ public DefaultedMap(Object defaultValue) { super(new HashMap()); if (defaultValue instanceof Transformer) { defaultValue = ConstantTransformer.getInstance(defaultValue); } this.value = defaultValue; }
/** * Constructs a new empty <code>DefaultedMap</code> that decorates * a <code>HashMap</code>. * <p> * The object passed in will be returned by the map whenever an * unknown key is requested. * * @param defaultValue the default value to return when the key is not found */ public DefaultedMap(Object defaultValue) { super(new HashMap()); if (defaultValue instanceof Transformer) { defaultValue = ConstantTransformer.getInstance(defaultValue); } this.value = defaultValue; }
/** * Factory method to create a defaulting map. * <p> * The value specified is returned when a missing key is found. * * @param map the map to decorate, must not be null * @param defaultValue the default value to return when the key is not found * @throws IllegalArgumentException if map is null */ public static Map decorate(Map map, Object defaultValue) { if (defaultValue instanceof Transformer) { defaultValue = ConstantTransformer.getInstance(defaultValue); } return new DefaultedMap(map, defaultValue); }
/** * Factory method to create a defaulting map. * <p> * The value specified is returned when a missing key is found. * * @param map the map to decorate, must not be null * @param defaultValue the default value to return when the key is not found * @throws IllegalArgumentException if map is null */ public static Map decorate(Map map, Object defaultValue) { if (defaultValue instanceof Transformer) { defaultValue = ConstantTransformer.getInstance(defaultValue); } return new DefaultedMap(map, defaultValue); }
/** * Creates a Transformer that will return the same object each time the * transformer is used. * * @see org.apache.commons.collections.functors.ConstantTransformer * * @param constantToReturn the constant object to return each time in the transformer * @return the transformer. */ public static Transformer constantTransformer(Object constantToReturn) { return ConstantTransformer.getInstance(constantToReturn); }
/** * Creates a Transformer that will return the same object each time the * transformer is used. * * @see org.apache.commons.collections.functors.ConstantTransformer * * @param constantToReturn the constant object to return each time in the transformer * @return the transformer. */ public static Transformer constantTransformer(Object constantToReturn) { return ConstantTransformer.getInstance(constantToReturn); }
/** * Creates a Transformer that will return the same object each time the * transformer is used. * * @see org.apache.commons.collections.functors.ConstantTransformer * * @param constantToReturn the constant object to return each time in the transformer * @return the transformer. */ public static Transformer constantTransformer(Object constantToReturn) { return ConstantTransformer.getInstance(constantToReturn); }
/** * Creates a Transformer that will return the same object each time the * transformer is used. * * @see org.apache.commons.collections.functors.ConstantTransformer * * @param constantToReturn the constant object to return each time in the transformer * @return the transformer. */ public static Transformer constantTransformer(Object constantToReturn) { return ConstantTransformer.getInstance(constantToReturn); }
/** * Creates a Transformer that will return the same object each time the * transformer is used. * * @see org.apache.commons.collections.functors.ConstantTransformer * * @param constantToReturn the constant object to return each time in the transformer * @return the transformer. */ public static Transformer constantTransformer(Object constantToReturn) { return ConstantTransformer.getInstance(constantToReturn); }
/** * Constructs a new empty <code>DefaultedMap</code> that decorates * a <code>HashMap</code>. * <p> * The object passed in will be returned by the map whenever an * unknown key is requested. * * @param defaultValue the default value to return when the key is not found */ public DefaultedMap(Object defaultValue) { super(new HashMap()); if (defaultValue instanceof Transformer) { defaultValue = ConstantTransformer.getInstance(defaultValue); } this.value = defaultValue; }
/** * Constructs a new empty <code>DefaultedMap</code> that decorates * a <code>HashMap</code>. * <p> * The object passed in will be returned by the map whenever an * unknown key is requested. * * @param defaultValue the default value to return when the key is not found */ public DefaultedMap(Object defaultValue) { super(new HashMap()); if (defaultValue instanceof Transformer) { defaultValue = ConstantTransformer.getInstance(defaultValue); } this.value = defaultValue; }
/** * Constructs a new empty <code>DefaultedMap</code> that decorates * a <code>HashMap</code>. * <p> * The object passed in will be returned by the map whenever an * unknown key is requested. * * @param defaultValue the default value to return when the key is not found */ public DefaultedMap(Object defaultValue) { super(new HashMap()); if (defaultValue instanceof Transformer) { defaultValue = ConstantTransformer.getInstance(defaultValue); } this.value = defaultValue; }
/** * Constructs a new empty <code>DefaultedMap</code> that decorates * a <code>HashMap</code>. * <p> * The object passed in will be returned by the map whenever an * unknown key is requested. * * @param defaultValue the default value to return when the key is not found */ public DefaultedMap(Object defaultValue) { super(new HashMap()); if (defaultValue instanceof Transformer) { defaultValue = ConstantTransformer.getInstance(defaultValue); } this.value = defaultValue; }
/** * Factory method to create a defaulting map. * <p> * The value specified is returned when a missing key is found. * * @param map the map to decorate, must not be null * @param defaultValue the default value to return when the key is not found * @throws IllegalArgumentException if map is null */ public static Map decorate(Map map, Object defaultValue) { if (defaultValue instanceof Transformer) { defaultValue = ConstantTransformer.getInstance(defaultValue); } return new DefaultedMap(map, defaultValue); }
/** * Factory method to create a defaulting map. * <p> * The value specified is returned when a missing key is found. * * @param map the map to decorate, must not be null * @param defaultValue the default value to return when the key is not found * @throws IllegalArgumentException if map is null */ public static Map decorate(Map map, Object defaultValue) { if (defaultValue instanceof Transformer) { defaultValue = ConstantTransformer.getInstance(defaultValue); } return new DefaultedMap(map, defaultValue); }
/** * Factory method to create a defaulting map. * <p> * The value specified is returned when a missing key is found. * * @param map the map to decorate, must not be null * @param defaultValue the default value to return when the key is not found * @throws IllegalArgumentException if map is null */ public static Map decorate(Map map, Object defaultValue) { if (defaultValue instanceof Transformer) { defaultValue = ConstantTransformer.getInstance(defaultValue); } return new DefaultedMap(map, defaultValue); }
/** * Factory method to create a defaulting map. * <p> * The value specified is returned when a missing key is found. * * @param map the map to decorate, must not be null * @param defaultValue the default value to return when the key is not found * @throws IllegalArgumentException if map is null */ public static Map decorate(Map map, Object defaultValue) { if (defaultValue instanceof Transformer) { defaultValue = ConstantTransformer.getInstance(defaultValue); } return new DefaultedMap(map, defaultValue); }
/** * Factory method to create a defaulting map. * <p> * The value specified is returned when a missing key is found. * * @param map the map to decorate, must not be null * @param defaultValue the default value to return when the key is not found * @throws IllegalArgumentException if map is null */ public static Map decorate(Map map, Object defaultValue) { if (defaultValue instanceof Transformer) { defaultValue = ConstantTransformer.getInstance(defaultValue); } return new DefaultedMap(map, defaultValue); }