From 94cdf6f2dc3343f3414e071172ddccffe7334708 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 16 Mar 2007 20:51:18 +0000 Subject: [PATCH] Some of this got moved into samskivert. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4628 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/presents/tools/GenUtil.java | 52 +------------------ 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/src/java/com/threerings/presents/tools/GenUtil.java b/src/java/com/threerings/presents/tools/GenUtil.java index bec4c9b3a..ecdcaebd5 100644 --- a/src/java/com/threerings/presents/tools/GenUtil.java +++ b/src/java/com/threerings/presents/tools/GenUtil.java @@ -39,7 +39,7 @@ import com.samskivert.util.StringUtil; /** * Utility methods used by our various source code generating tasks. */ -public class GenUtil +public class GenUtil extends com.samskivert.util.GenUtil { /** A regular expression for matching the package declaration. */ public static final Pattern PACKAGE_PATTERN = @@ -51,56 +51,6 @@ public class GenUtil Pattern.compile("^\\s*public\\s+(?:abstract\\s+)?" + "(interface|class)\\s+(\\S+)(\\W|$)"); - /** - * Returns the name of the supplied class as it would likely appear in code - * using the class (no package prefix, arrays specified as - * type[]). - */ - public static String simpleName (Field field) - { - String cname; - Class clazz = field.getType(); - if (clazz.isArray()) { - if (field.getGenericType() instanceof GenericArrayType) { - GenericArrayType atype = (GenericArrayType) - field.getGenericType(); - cname = atype.getGenericComponentType().toString(); - } else { - return simpleName(clazz.getComponentType(), - field.getGenericType()) + "[]"; - } - } else if (field.getGenericType() instanceof ParameterizedType) { - cname = field.getGenericType().toString(); - } else { - cname = clazz.getName(); - } - - Package pkg = clazz.getPackage(); - int offset = (pkg == null) ? 0 : pkg.getName().length()+1; - return StringUtil.replace(cname.substring(offset), "$", "."); - } - - /** - * Returns the name of the supplied class as it would likely appear in code - * using the class (no package prefix, arrays specified as - * type[]). - */ - public static String simpleName (Class clazz, Type type) - { - if (clazz.isArray()) { - return simpleName(clazz.getComponentType(), type) + "[]"; - } else { - String cname = clazz.getName(); - if (type instanceof ParameterizedType) { - cname = type.toString(); - } - Package pkg = clazz.getPackage(); - int offset = (pkg == null) ? 0 : pkg.getName().length()+1; - String name = cname.substring(offset); - return StringUtil.replace(name, "$", "."); - } - } - /** * Returns the name of the supplied class as it would appear in * ActionScript code using the class (no package prefix, arrays specified