EchoPoint
1.0

echopoint.util.reflect
Interface ReflectionSetter

All Known Implementing Classes:
AbstractDateTimeField, ClientDatePicker, ComboBox, DefaultTreeCellRenderer, DevNull, EchoPointComponent, EmbeddedPane, HourGlass, HtmlContainer, Label, MenuItem, NumberFormatField, PagedTableController, Panel, PushButton, RichTextArea, SelectableTable, SortableTable, SortableTableHeaderRenderer, SpinField, Timer

public interface ReflectionSetter

The ReflectionSetter interface is used when a SecurityManager prevents direct setting of private field values via Field.setAccessible(boolean). This is rarely needed as Echo application do not typically run in a sandbox that restricts Field.setAccessible().

If the SecurityManager does not allow accessibility, then this interface is used to delegate the field setting to another class, almosts always the class that actually contains the field.

The helper method set must be implemented in each class in the hierarchy. This is because the security manager will only allow the actual class to set non-public fields, not super-classes.

See Also:
Field, AccessibleObject.setAccessible(boolean)., EchoPointComponent.set(Object, String, Object)

Method Summary
 java.lang.Object set(java.lang.reflect.Field field, java.lang.Object newValue)
          Called to save the old value of a field, set in a new value and return the old value of a field.
 

Method Detail

set

public java.lang.Object set(java.lang.reflect.Field field,
                            java.lang.Object newValue)
                     throws java.lang.Exception
Called to save the old value of a field, set in a new value and return the old value of a field. This interface allows a field set operation to be "delegated" back into the class that has permission to perform the field set.

 public Object set(Field f, Object newValue) throws Exception {
      Object oldValue = f.get(this);
      f.set(this,newValue);
      return oldValue;
 }
 

Parameters:
field - - the field to be set
newValue - - the new value to be set
Returns:
the oldValue of the field
Throws:
java.lang.IllegalAccessException
java.lang.IllegalArgumentException
java.lang.NullPointerException
java.lang.ExceptionInInitializerError
java.lang.Exception

EchoPoint
1.0