Clover coverage report - Code Coverage for tapestry release 4.0-alpha-2
Coverage timestamp: Thu May 5 2005 09:57:44 EDT
file stats: LOC: 145   Methods: 0
NCLOC: 19   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
EnhancementOperation.java - - - -
coverage
 1   
 // Copyright 2004, 2005 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.tapestry.enhance;
 16   
 
 17   
 import java.util.List;
 18   
 
 19   
 import org.apache.hivemind.service.MethodSignature;
 20   
 
 21   
 /**
 22   
  * A process object representing enhancements to a component class. The operation is passed to
 23   
  * {@link org.apache.tapestry.enhance.EnhancementWorker}objects that perform enhancements.
 24   
  * 
 25   
  * @author Howard M. Lewis Ship
 26   
  * @since 4.0
 27   
  */
 28   
 public interface EnhancementOperation
 29   
 {
 30   
     /**
 31   
      * Claims a property. Most enhancements are concerned with adding properties. Some enhancement
 32   
      * workers exist to fill in defaults, and they need to know what properties have already been
 33   
      * spoken for by eariler enhancement works.
 34   
      * 
 35   
      * @throws org.apache.hivemind.ApplicationRuntimeException
 36   
      *             if the property was previously claimed
 37   
      */
 38   
 
 39   
     public void claimProperty(String propertyName);
 40   
 
 41   
     /**
 42   
      * Returns a list of the names of existing properties that are not claimed and which have
 43   
      * abstract accessor methods.
 44   
      */
 45   
 
 46   
     public List findUnclaimedAbstractProperties();
 47   
 
 48   
     /**
 49   
      * Adds a field to the enhanced class; the field will be private and use the provided name and
 50   
      * type.
 51   
      */
 52   
 
 53   
     public void addField(String name, Class type);
 54   
 
 55   
     /**
 56   
      * Adds a field containing an initial value. The EnhancementOperation will ensure that the value
 57   
      * is passed into the enhanced class' constructor and assigned.
 58   
      */
 59   
 
 60   
     public void addField(String name, Class type, Object value);
 61   
 
 62   
     /**
 63   
      * Converts a type name (an object class name, a primtive name, or an array) into the
 64   
      * corresponding Class object.
 65   
      */
 66   
 
 67   
     public Class convertTypeName(String type);
 68   
 
 69   
     /**
 70   
      * Confirms that the named property either doesn't exist (in the component base class), or that
 71   
      * the type of the property exactly matches the indicated type.
 72   
      */
 73   
 
 74   
     public void validateProperty(String name, Class expectedType);
 75   
 
 76   
     /**
 77   
      * Returns the name of the accessor method for the given property (if it exists in the component
 78   
      * base class), or fabricates a new name if it does not.
 79   
      */
 80   
 
 81   
     public String getAccessorMethodName(String propertyName);
 82   
 
 83   
     /**
 84   
      * Adds a method to the enhanced class.
 85   
      * 
 86   
      * @param modifier
 87   
      *            as defined by {@link java.lang.reflect.Modifier}, typically
 88   
      *            {@link java.lang.reflect.Modifier#PUBLIC}
 89   
      * @param sig
 90   
      *            the method signature (defining name, return type, etc.)
 91   
      * @param methodBody
 92   
      *            a Javassist code snippet for the method body
 93   
      */
 94   
     public void addMethod(int modifier, MethodSignature sig, String methodBody);
 95   
 
 96   
     /**
 97   
      * Returns the base component class, as defined in the specification (or defaulted). An enhaced
 98   
      * subclass of the component class will usually be created.
 99   
      */
 100   
     public Class getBaseClass();
 101   
 
 102   
     /**
 103   
      * Returns a reference to a particular class. This will, effectively, by the name of a private
 104   
      * field.
 105   
      */
 106   
 
 107   
     public String getClassReference(Class clazz);
 108   
 
 109   
     /**
 110   
      * Returns the type of an existing property of the base component class. If the property does
 111   
      * not exist, then returns null.
 112   
      */
 113   
 
 114   
     public Class getPropertyType(String name);
 115   
 
 116   
     /**
 117   
      * Allows for a kind of distributed construction of a particular method, within a particular
 118   
      * interface. Code can be appended to the method's implementation throughout the course of the
 119   
      * enhancement operation. When the enhanced class is finialized, the method is added with
 120   
      * whatever contents are in its body. If the base class implements the method, then the method
 121   
      * body will include an initial call to that implementation.
 122   
      * <p>
 123   
      * At this time, this works best for void methods (since there isn't an easy way to ensure code
 124   
      * would be inserted before a final return statement).
 125   
      * 
 126   
      * @param interfaceClass
 127   
      *            the interface containing the method. If the base class does not implement the
 128   
      *            interface, then the enhanced class will have the interface added.
 129   
      * @param methodSignature
 130   
      *            the signature of the method to be added.
 131   
      * @param code
 132   
      *            the Javassist markup to be added to the body of the method.
 133   
      */
 134   
     public void extendMethodImplementation(Class interfaceClass, MethodSignature methodSignature,
 135   
             String code);
 136   
     
 137   
     /**
 138   
      * Returns true if the class implements the specified interface.  Checks the base class
 139   
      * (as identified in the specification), but <em>also</em> accounts for any additional
 140   
      * interfaces that may be added by {@link #extendMethodImplementation(Class, MethodSignature, String)}.
 141   
      * 
 142   
      */
 143   
     
 144   
     public boolean implementsInterface(Class interfaceClass);
 145   
 }