|
Last change
on this file was
2,
checked in by dsowen, 21 years ago
|
|
Initial commit.
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
|
File size:
816 bytes
|
| Line | |
|---|
| 1 | /* |
|---|
| 2 | * Created on Aug 2, 2005 |
|---|
| 3 | * |
|---|
| 4 | * $Log$ |
|---|
| 5 | * Revision 1.1 2005/08/03 00:35:29 dsowen |
|---|
| 6 | * Initial commit. |
|---|
| 7 | * |
|---|
| 8 | */ |
|---|
| 9 | package ws.fugue88.jpath; |
|---|
| 10 | |
|---|
| 11 | import java.lang.reflect.InvocationTargetException; |
|---|
| 12 | import java.lang.reflect.Method; |
|---|
| 13 | |
|---|
| 14 | /** |
|---|
| 15 | * @author dsowen |
|---|
| 16 | */ |
|---|
| 17 | public class MutableMethodProperty extends ImmutableMethodProperty { |
|---|
| 18 | |
|---|
| 19 | MutableMethodProperty(String name, Class clas, String get_method, |
|---|
| 20 | String set_method) throws NoSuchMethodException |
|---|
| 21 | { |
|---|
| 22 | super(name, clas, get_method); |
|---|
| 23 | |
|---|
| 24 | _set = clas.getDeclaredMethod(set_method, new Class[] { getType() }); |
|---|
| 25 | _set.setAccessible(true); |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | public void setValue(Object that, Object value) |
|---|
| 29 | throws InvocationTargetException |
|---|
| 30 | { |
|---|
| 31 | try { |
|---|
| 32 | _set.invoke(that, new Object[] { value }); |
|---|
| 33 | } catch(IllegalAccessException e) { |
|---|
| 34 | throw new Error(e); |
|---|
| 35 | } |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | private Method _set; |
|---|
| 39 | |
|---|
| 40 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.