java: refactor DynamicCodeGen.java

This commit is contained in:
Muga Nishizawa 2010-10-07 23:53:01 +09:00
parent 4bbfb3f9a3
commit a3d831b723
3 changed files with 10 additions and 4 deletions

View File

@ -86,6 +86,10 @@ public interface BasicConstants {
String VARIABLE_NAME_TEMPLATES0 = "_$$_tmpls"; String VARIABLE_NAME_TEMPLATES0 = "_$$_tmpls";
String VARIABLE_NAME_CLIENT = "_$$_client";
String VARIABLE_NAME_CLIENT0 = "_$$_c";
String METHOD_NAME_VALUEOF = "valueOf"; String METHOD_NAME_VALUEOF = "valueOf";
String METHOD_NAME_BOOLEANVALUE = "booleanValue"; String METHOD_NAME_BOOLEANVALUE = "booleanValue";
@ -128,6 +132,8 @@ public interface BasicConstants {
String METHOD_NAME_SETTEMPLATES = "setTemplates"; String METHOD_NAME_SETTEMPLATES = "setTemplates";
String METHOD_NAME_SETCLIENT = "setClient";
String METHOD_NAME_PACK = "pack"; String METHOD_NAME_PACK = "pack";
String METHOD_NAME_PACKARRAY = "packArray"; String METHOD_NAME_PACKARRAY = "packArray";

View File

@ -38,7 +38,7 @@ import org.msgpack.annotation.MessagePackOrdinalEnum;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class DynamicCodeGen extends DynamicCodeGenBase implements Constants { class DynamicCodeGen extends DynamicCodeGenBase implements Constants {
private static Logger LOG = LoggerFactory.getLogger(DynamicCodeGen.class); private static Logger LOG = LoggerFactory.getLogger(DynamicCodeGen.class);

View File

@ -134,7 +134,7 @@ public class DynamicCodeGenBase implements BasicConstants {
sb.append(name); sb.append(name);
} }
static int getArrayDim(Class<?> type) { protected int getArrayDim(Class<?> type) {
if (type.isArray()) { if (type.isArray()) {
return 1 + getArrayDim(type.getComponentType()); return 1 + getArrayDim(type.getComponentType());
} else { } else {
@ -142,7 +142,7 @@ public class DynamicCodeGenBase implements BasicConstants {
} }
} }
static Class<?> getArrayBaseType(Class<?> type) { protected Class<?> getArrayBaseType(Class<?> type) {
if (type.isArray()) { if (type.isArray()) {
return getArrayBaseType(type.getComponentType()); return getArrayBaseType(type.getComponentType());
} else { } else {
@ -150,7 +150,7 @@ public class DynamicCodeGenBase implements BasicConstants {
} }
} }
public String arrayTypeToString(Class<?> type) { protected String arrayTypeToString(Class<?> type) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
int dim = getArrayDim(type); int dim = getArrayDim(type);
Class<?> t = getArrayBaseType(type); Class<?> t = getArrayBaseType(type);