public class CodeGenerator extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
JAVA_CLASS_FILE_SUFFIX |
static String |
JAVA_END
java line end
|
static String |
JAVA_LINE_BREAK
line break for JAVA
|
static String |
LINE_BREAK
line break for editor
|
| 构造器和说明 |
|---|
CodeGenerator(List<FieldInfo> fields,
Class<?> cls,
String codecClassName,
boolean genericSupports)
Constructor
|
| 限定符和类型 | 方法和说明 |
|---|---|
StringBuilder |
genPackageCode()
generate package code
|
protected String |
getAccessByField(String target,
Field field,
Class<?> cls)
get field access code
|
String |
getClassName()
get new class name
|
static String |
getClassName(Class<?> cls) |
String |
getCode()
get full java class code.
|
String |
getCodecClassName() |
String |
getDecodeMethodCode()
generate
decode method source code |
String |
getEncodeMethodCode()
generate
encode method source code |
String |
getFullClassName()
get new class name with full package
|
static String |
getFullClassName(Class<?> cls)
get new class name with full package
|
List<String> |
getImportPackages() |
String |
getPackage() |
static String |
getPackage(Class<?> cls) |
String |
getReadFromMethodCode()
generate
readFrom method source code |
Set<Class<?>> |
getRelativeProxyClasses()
get relativeProxyClasses
|
protected String |
getSetToField(String target,
Field field,
Class<?> cls,
String express,
boolean isList)
generate access
Field value source code. support public field access, getter method access and reflection
access. |
String |
getSizeMethodCode()
generate
size method source code |
String |
getWriteToMethodCode()
generate
writeTo method source code |
boolean |
isDebug()
get the debug
|
static boolean |
isListType(Field field)
|
void |
setDebug(boolean debug)
set debug value to debug
|
void |
setOutputPath(File outputPath)
set outputPath value to outputPath
|
public Set<Class<?>> getRelativeProxyClasses()
public void setOutputPath(File outputPath)
outputPath - the outputPath to setpublic boolean isDebug()
public void setDebug(boolean debug)
debug - the debug to setpublic String getCodecClassName()
public String getClassName()
public String getPackage()
public static String getFullClassName(Class<?> cls)
public String getFullClassName()
public StringBuilder genPackageCode()
code - public String getCode()
public String getDecodeMethodCode()
decode method source codepublic String getReadFromMethodCode()
readFrom method source codepublic static boolean isListType(Field field)
field - Listpublic String getEncodeMethodCode()
encode method source codepublic String getWriteToMethodCode()
writeTo method source codepublic String getSizeMethodCode()
size method source codeprotected String getAccessByField(String target, Field field, Class<?> cls)
target - target instance namefield - java field instancecls - mapped classCopyright © 2015 Baidu, Inc.. All rights reserved.