org.marketcetera.util.auth
Class SpringSetter<T extends Holder<?>>

java.lang.Object
  extended by org.marketcetera.util.auth.Setter<T>
      extended by org.marketcetera.util.auth.SpringSetter<T>
Direct Known Subclasses:
SpringSetterCharArray, SpringSetterString

public abstract class SpringSetter<T extends Holder<?>>
extends Setter<T>

A setter that obtains holder data via Spring configuration properties. It is supported by a SpringContext. It uses a proxy bean to read the (final) value of a property from one (or more overriding) properties files.

Since:
0.5.0
Version:
$Id: SpringSetter.java 16154 2012-07-14 16:34:05Z colin $
Author:
tlerios@marketcetera.com

Constructor Summary
SpringSetter(T holder, I18NBoundMessage usage, String propertyName)
          Constructor mirroring superclass constructor.
 
Method Summary
 String getPropertyName()
          Returns the receiver's property name.
 Object getPropertyValue(GenericApplicationContext context)
          Returns the receiver's property value.
 void setup(GenericApplicationContext context, Properties properties, int index)
          Injects the receiver's proxy bean into the given context.
abstract  void setValue(GenericApplicationContext context)
          Sets the holder's data by obtaining it from the given context via the receiver's proxy bean.
 
Methods inherited from class org.marketcetera.util.auth.Setter
getHolder, getUsage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringSetter

public SpringSetter(T holder,
                    I18NBoundMessage usage,
                    String propertyName)
Constructor mirroring superclass constructor. The property whose value is assigned to the holder data has the given name.

Parameters:
propertyName - The property name.
See Also:
Setter.Setter(Holder,I18NBoundMessage)
Method Detail

getPropertyName

public String getPropertyName()
Returns the receiver's property name.

Returns:
The property name.

getPropertyValue

public Object getPropertyValue(GenericApplicationContext context)
Returns the receiver's property value.

Parameters:
context - The context hosting the receiver's proxy bean.
Returns:
The property value.

setup

public void setup(GenericApplicationContext context,
                  Properties properties,
                  int index)
Injects the receiver's proxy bean into the given context. The injected bean is assigned a unique name based on the given index. The given properties are augmented with a default value (empty string, that is, do-not-touch-holder) for the receiver's property.

Parameters:
context - The context.
properties - The properties.
index - The index.

setValue

public abstract void setValue(GenericApplicationContext context)
Sets the holder's data by obtaining it from the given context via the receiver's proxy bean. This method is called by a SpringContext.

Parameters:
context - The context.


Copyright © 2012. All Rights Reserved.