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/10 03:54:31 UTC
svn commit: r1090729 - in
/tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5:
internal/plastic/ plastic/
Author: hlship
Date: Sun Apr 10 01:54:31 2011
New Revision: 1090729
URL: http://svn.apache.org/viewvc?rev=1090729&view=rev
Log:
Move static methods toTypeName() and toTypeNames() to the public PlasticUtils class
Modified:
tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/InstructionBuilderImpl.java
tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/NameCache.java
tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticInternalUtils.java
tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodDescription.java
tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/PlasticUtils.java
Modified: tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/InstructionBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/InstructionBuilderImpl.java?rev=1090729&r1=1090728&r2=1090729&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/InstructionBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/InstructionBuilderImpl.java Sun Apr 10 01:54:31 2011
@@ -22,6 +22,7 @@ import org.apache.tapestry5.plastic.Inst
import org.apache.tapestry5.plastic.InstructionBuilderCallback;
import org.apache.tapestry5.plastic.MethodDescription;
import org.apache.tapestry5.plastic.PlasticField;
+import org.apache.tapestry5.plastic.PlasticUtils;
import org.apache.tapestry5.plastic.SwitchCallback;
import org.apache.tapestry5.plastic.TryCatchCallback;
@@ -181,7 +182,7 @@ public class InstructionBuilderImpl exte
private void doInvoke(int opcode, Class clazz, Class returnType, String methodName, Class... argumentTypes)
{
doInvoke(opcode, clazz.getName(), cache.toTypeName(returnType), methodName,
- PlasticInternalUtils.toTypeNames(argumentTypes));
+ PlasticUtils.toTypeNames(argumentTypes));
}
public InstructionBuilder invoke(Class clazz, Class returnType, String methodName, Class... argumentTypes)
@@ -363,7 +364,7 @@ public class InstructionBuilderImpl exte
{
check();
- return invokeConstructor(clazz.getName(), PlasticInternalUtils.toTypeNames(argumentTypes));
+ return invokeConstructor(clazz.getName(), PlasticUtils.toTypeNames(argumentTypes));
}
public InstructionBuilder dupe(int depth)
Modified: tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/NameCache.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/NameCache.java?rev=1090729&r1=1090728&r2=1090729&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/NameCache.java (original)
+++ tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/NameCache.java Sun Apr 10 01:54:31 2011
@@ -15,6 +15,7 @@
package org.apache.tapestry5.internal.plastic;
import org.apache.tapestry5.plastic.MethodDescription;
+import org.apache.tapestry5.plastic.PlasticUtils;
/**
* A cache of translations from type names to internal names and descriptors, as well as a cache from MethodDescription
@@ -65,7 +66,7 @@ public class NameCache
@Override
protected String convert(Class type)
{
- return PlasticInternalUtils.toTypeName(type);
+ return PlasticUtils.toTypeName(type);
};
};
Modified: tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticInternalUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticInternalUtils.java?rev=1090729&r1=1090728&r2=1090729&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticInternalUtils.java (original)
+++ tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/internal/plastic/PlasticInternalUtils.java Sun Apr 10 01:54:31 2011
@@ -218,29 +218,6 @@ public class PlasticInternalUtils
return new ArrayList<T>();
}
- /**
- * Converts a type (including array and primitive types) to their type name (the way they are represented in Java
- * source files).
- */
- public static String toTypeName(Class type)
- {
- if (type.isArray())
- return toTypeName(type.getComponentType()) + "[]";
-
- return type.getName();
- }
-
- /** Converts a number of types (usually, arguments to a method or constructor) into their type names. */
- public static String[] toTypeNames(Class[] types)
- {
- String[] result = new String[types.length];
-
- for (int i = 0; i < result.length; i++)
- result[i] = toTypeName(types[i]);
-
- return result;
- }
-
public static void debugClass(ClassNode classNode)
{
if (!DEBUG_ENABLED)
Modified: tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodDescription.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodDescription.java?rev=1090729&r1=1090728&r2=1090729&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodDescription.java (original)
+++ tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodDescription.java Sun Apr 10 01:54:31 2011
@@ -105,8 +105,8 @@ public class MethodDescription implement
/** Creates a MethodDescription from a Java Method. */
public MethodDescription(Method method)
{
- this(method.getModifiers(), PlasticInternalUtils.toTypeName(method.getReturnType()), method.getName(),
- PlasticInternalUtils.toTypeNames(method.getParameterTypes()), PlasticInternalUtils.toTypeNames(method
+ this(method.getModifiers(), PlasticUtils.toTypeName(method.getReturnType()), method.getName(),
+ PlasticUtils.toTypeNames(method.getParameterTypes()), PlasticUtils.toTypeNames(method
.getExceptionTypes()));
}
Modified: tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/PlasticUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/PlasticUtils.java?rev=1090729&r1=1090728&r2=1090729&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/PlasticUtils.java (original)
+++ tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/PlasticUtils.java Sun Apr 10 01:54:31 2011
@@ -37,4 +37,27 @@ public class PlasticUtils
{
return Long.toHexString(PlasticUtils.UID_GENERATOR.getAndIncrement());
}
+
+ /**
+ * Converts a type (including array and primitive types) to their type name (the way they are represented in Java
+ * source files).
+ */
+ public static String toTypeName(Class type)
+ {
+ if (type.isArray())
+ return toTypeName(type.getComponentType()) + "[]";
+
+ return type.getName();
+ }
+
+ /** Converts a number of types (usually, arguments to a method or constructor) into their type names. */
+ public static String[] toTypeNames(Class[] types)
+ {
+ String[] result = new String[types.length];
+
+ for (int i = 0; i < result.length; i++)
+ result[i] = toTypeName(types[i]);
+
+ return result;
+ }
}