use of org.gsonformat.intellij.entity.ClassEntity in project GsonFormat by zzz40500.
the class ConvertBridge method recursionInnerClass.
private void recursionInnerClass(ClassEntity classEntity) {
PsiClass[] innerClassArray = classEntity.getPsiClass().getAllInnerClasses();
for (PsiClass psiClass : innerClassArray) {
ClassEntity item = new ClassEntity();
item.setLock(true);
if (declareClass.containsKey(psiClass.getQualifiedName())) {
return;
}
declareClass.put(psiClass.getQualifiedName(), item);
CheckUtil.getInstant().addDeclareClassName(psiClass.getQualifiedName());
item.setClassName(psiClass.getName());
item.addAllFields(collectDeclareFields(psiClass));
item.setPsiClass(psiClass);
item.setPackName(getPackName(psiClass));
recursionInnerClass(item);
}
}
use of org.gsonformat.intellij.entity.ClassEntity in project GsonFormat by zzz40500.
the class ConvertBridge method typeByValue.
private FieldEntity typeByValue(ClassEntity parentClass, String key, Object type) {
FieldEntity result;
if (type instanceof JSONObject) {
ClassEntity classEntity = existDeclareClass((JSONObject) type);
if (classEntity == null) {
FieldEntity fieldEntity = new FieldEntity();
ClassEntity innerClassEntity = createInnerClass(createSubClassName(key, type), (JSONObject) type, parentClass);
fieldEntity.setKey(key);
fieldEntity.setTargetClass(innerClassEntity);
result = fieldEntity;
} else {
FieldEntity fieldEntity = new FieldEntity();
fieldEntity.setKey(key);
fieldEntity.setTargetClass(classEntity);
result = fieldEntity;
}
} else if (type instanceof JSONArray) {
result = handleJSONArray(parentClass, (JSONArray) type, key, 1);
} else {
FieldEntity fieldEntity = new FieldEntity();
fieldEntity.setKey(key);
fieldEntity.setType(DataType.typeOfObject(type).getValue());
result = fieldEntity;
if (type != null) {
result.setValue(type.toString());
}
}
result.setKey(key);
return result;
}
use of org.gsonformat.intellij.entity.ClassEntity in project GsonFormat by zzz40500.
the class ConvertBridge method handleClassReferenceType.
private void handleClassReferenceType(FieldEntity fieldEntity, PsiClass psi) {
if (psi == null || psi.getQualifiedName() == null) {
return;
}
switch(psi.getQualifiedName()) {
case "java.lang.String":
fieldEntity.setType("String");
break;
case "java.lang.Boolean":
fieldEntity.setType("Boolean");
break;
case "java.lang.Integer":
fieldEntity.setType("Integer");
break;
case "java.lang.Double":
fieldEntity.setType("Double");
break;
case "java.lang.Long":
fieldEntity.setType("Long");
break;
default:
ClassEntity classEntity = declareClass.get(psi.getQualifiedName());
if (classEntity == null) {
classEntity = collectClassAttribute(psi, true);
}
fieldEntity.setTargetClass(classEntity);
break;
}
}
Aggregations