View Javadoc

1   /*$Id: MethodColumnWrapperTable.java,v 1.2 2004/12/07 16:50:33 jdt Exp $
2    * Created on 07-Dec-2004
3    *
4    * Copyright (C) AstroGrid. All rights reserved.
5    *
6    * This software is published under the terms of the AstroGrid 
7    * Software License version 1.2, a copy of which has been included 
8    * with this distribution in the LICENSE.txt file.  
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  $Log: MethodColumnWrapperTable.java,v $
51  Revision 1.2  2004/12/07 16:50:33  jdt
52  merges from scripting-nww-805
53  
54  Revision 1.1.2.1  2004/12/07 14:47:58  nw
55  got table manipulation working.
56   
57  */