001 // Copyright 2011 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 015 package org.apache.tapestry5.internal.plastic; 016 017 import org.apache.tapestry5.plastic.FieldHandle; 018 import org.apache.tapestry5.plastic.MethodHandle; 019 import org.apache.tapestry5.plastic.MethodInvocationResult; 020 import org.apache.tapestry5.plastic.PlasticClass; 021 022 /** 023 * The interface for a "shim" class that provides the necessary hooks needed 024 * by {@link FieldHandle} and {@link MethodHandle} implementations for a particular, 025 * instantiated {@link PlasticClass}. 026 */ 027 public abstract class PlasticClassHandleShim 028 { 029 /** 030 * Gets the field at the given index. 031 * 032 * @param instance 033 * object to read instance field from 034 * @param fieldIndex 035 * assigned index for the field 036 * @return the field's value 037 * @see FieldHandle#get(Object) 038 */ 039 public Object get(Object instance, int fieldIndex) 040 { 041 return null; 042 } 043 044 /** 045 * Sets the value of a field. 046 * 047 * @param instance 048 * object to update instance field in 049 * @param fieldIndex 050 * assigned index for the field 051 * @param newValue 052 * new value for field 053 * @see FieldHandle#set(Object, Object) 054 */ 055 public void set(Object instance, int fieldIndex, Object newValue) 056 { 057 } 058 059 /** 060 * Invokes a method. 061 * 062 * @param instance 063 * object to invoke a method upon 064 * @param methodIndex 065 * assigned index for the method 066 * @param arguments 067 * arguments to pass to the method 068 * @return result of invoking the method 069 */ 070 public MethodInvocationResult invoke(Object instance, int methodIndex, Object[] arguments) 071 { 072 return null; 073 } 074 }