1
2
3
4
5
6
7
8
9
10
11 package org.astrogrid.scripting.table;
12
13 import java.lang.reflect.InvocationTargetException;
14 import java.lang.reflect.Method;
15
16 import uk.ac.starlink.table.ColumnInfo;
17 import uk.ac.starlink.table.StarTable;
18
19 /*** Define a new column, based on values returned by a {@link java.lang.reflect.Method}
20 * @author Noel Winstanley nw@jb.man.ac.uk 07-Dec-2004
21 *
22 */
23 class MethodColumnWrapperTable extends AbstractColumnWrapperTable implements
24 ScriptStarTable {
25
26 /*** Construct a new MethodColumnWrapperTable
27 * @param meta
28 * @param original
29 */
30 public MethodColumnWrapperTable(ColumnInfo meta,Method method, StarTable original) {
31 super(meta, original);
32 this.method=method;
33 }
34 protected final Method method;
35
36 /***
37 * @throws InvocationTargetException
38 * @throws IllegalAccessException
39 * @throws IllegalArgumentException
40 * @see org.astrogrid.scripting.table.AbstractColumnWrapperTable#computeValue(java.lang.Object[])
41 */
42 protected Object computeValue(Object[] row) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
43 return method.invoke(null,row);
44 }
45
46 }
47
48
49
50
51
52
53
54
55
56
57