You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2011/04/30 00:55:38 UTC
svn commit: r1097997 -
/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java
Author: hlship
Date: Fri Apr 29 22:55:37 2011
New Revision: 1097997
URL: http://svn.apache.org/viewvc?rev=1097997&view=rev
Log:
TAP5-853: Implement getSignature(), isDeclaredMethod() and getModfiers()
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java?rev=1097997&r1=1097996&r2=1097997&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java Fri Apr 29 22:55:37 2011
@@ -105,6 +105,12 @@ public class BridgeClassTransformation i
description.argumentTypes, description.checkedExceptionTypes);
}
+ private static MethodDescription toMethodDescription(TransformMethodSignature signature)
+ {
+ return new MethodDescription(signature.getModifiers(), signature.getReturnType(), signature.getMethodName(),
+ signature.getParameterTypes(), signature.getExceptionTypes());
+ }
+
private static class BridgeTransformField implements TransformField
{
private final PlasticField plasticField;
@@ -136,7 +142,7 @@ public class BridgeClassTransformation i
public String getSignature()
{
- throw new IllegalStateException("getSignature() not yet implemented.");
+ return plasticField.getGenericSignature();
}
public void claim(Object tag)
@@ -182,7 +188,7 @@ public class BridgeClassTransformation i
public int getModifiers()
{
- throw new IllegalStateException("getModifiers() not yet implemented.");
+ return plasticField.getModifiers();
}
public void inject(Object value)
@@ -563,8 +569,7 @@ public class BridgeClassTransformation i
public TransformMethod getOrCreateMethod(TransformMethodSignature signature)
{
- MethodDescription md = new MethodDescription(signature.getModifiers(), signature.getReturnType(),
- signature.getMethodName(), signature.getParameterTypes(), signature.getExceptionTypes());
+ MethodDescription md = toMethodDescription(signature);
PlasticMethod plasticMethod = plasticClass.introduceMethod(md);
@@ -573,7 +578,15 @@ public class BridgeClassTransformation i
public boolean isDeclaredMethod(TransformMethodSignature signature)
{
- throw new IllegalArgumentException("isDeclaredMethod() not yet implemented.");
+ final MethodDescription md = toMethodDescription(signature);
+
+ return !F.flow(plasticClass.getMethods()).filter(new Predicate<PlasticMethod>()
+ {
+ public boolean accept(PlasticMethod element)
+ {
+ return element.getDescription().equals(md);
+ }
+ }).isEmpty();
}
// TODO: This is very handy, there should be an additional object passed around that encapsulates