01: /*
02: * Created on Nov 4, 2005
03: */
04: package uk.org.ponder.beanutil;
05:
06: import uk.org.ponder.mapping.DAREnvironment;
07: import uk.org.ponder.mapping.DARList;
08: import uk.org.ponder.mapping.DataAlterationRequest;
09: import uk.org.ponder.mapping.ShellInfo;
10: import uk.org.ponder.messageutil.TargettedMessageList;
11:
12: /** The base interface for RSF's expression language (EL) */
13:
14: public interface BeanModelAlterer {
15:
16: /** Fetch a bean value by path from the supplied object root.
17: * @param fullpath The path of the bean to fetch
18: * @param root The root object which the path is relative to
19: * @param addressibleModel A model expressing permissible paths. May be <code>null</code>
20: * if the path requires no checking.
21: */
22: public Object getBeanValue(String fullpath, Object root,
23: BeanPredicateModel addressibleModel);
24:
25: public void setBeanValue(String fullpath, Object root,
26: Object value, TargettedMessageList messages,
27: boolean applyconversion);
28:
29: /** Invoke a bean method from a path in the model.
30: * @param shells An encoding of the method to be invoked, assumed to be fetched from
31: * {@link #fetchShells(String, Object)} - the section of the path
32: * referring to bean paths has terminated at the last bean present in the
33: * {@link ShellInfo#shells} array. The next path segment is assumed to be
34: * the method name, and the final section is filled with arguments.
35: * @param addressibleModel A model for the beans which are permissible to be
36: * addressed for this invocation. May be <code>null</code> if no security
37: * checks are required.
38: */
39: public Object invokeBeanMethod(ShellInfo shells,
40: BeanPredicateModel addressibleModel);
41:
42: /** Invoke a bean method from a path in the model. */
43: public Object invokeBeanMethod(String methodEL, Object rootobj);
44:
45: /**
46: * Apply the alterations mentioned in the enclosed DARList to the supplied
47: * bean. Note that this method assumes that the TargettedMessageList is
48: * already navigated to the root path referred to by the bean, and that the
49: * DARList mentions paths relative to that bean.
50: *
51: * @param rootobj The object to which alterations are to be applied
52: * @param toapply The list of alterations
53: * @param darenv A {@link DAREnvironment} record supplying any environment
54: * require for the application. May be <code>null</code>
55: */
56: public void applyAlterations(Object rootobj, DARList toapply,
57: DAREnvironment darenv);
58:
59: /** @see #applyAlterations(Object, DARList, TargettedMessageList) * */
60: public void applyAlteration(Object rootobj,
61: DataAlterationRequest dar, DAREnvironment darenv);
62:
63: /** Fetch the "shells" for the specified path through the bean model, which
64: * is an array of Object, one for each path segment in the supplied path. The
65: * array will quietly terminate at the first bean which is either <code>null</code> or
66: * a DARApplier. If <code>expectMethod</code> is true, it will also stop at
67: * any segment which is an exact match for a method name, or a MethodInvokingProxy.
68: */
69: public ShellInfo fetchShells(String fullpath, Object rootobj,
70: boolean expectMethod);
71:
72: /**
73: * Converts the object currently present at the supplied bean path into the
74: * specified target class, which must be one of the classes handled by the
75: * UIType framework.
76: *
77: * @param fullpath The full EL path from the root object from which the
78: * flattened value is to be fetched.
79: * @param root The root object
80: * @param targetclazz A class of one of the UIType types, or else
81: * <code>null</code>. If <code>null</code>, the type of the
82: * returned object will be either String[] or String, depending on
83: * whether the path holds an enumerable (vectorial) value or not.
84: * @param resolver A resolver which will be applied to each scalar value to
85: * convert it to String if necessary. If <code>null</code>,
86: * default leaf conversion will be applied.
87: */
88:
89: public Object getFlattenedValue(String fullpath, Object root,
90: Class targetclazz, BeanResolver resolver);
91: }
|