Skip to content

Commit

Permalink
- adds interfaces serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
baywet committed Nov 18, 2020
1 parent 1d6548a commit b9d571c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion typesummary/app/src/main/java/typesummary/App.java
Expand Up @@ -36,6 +36,7 @@ public static void main(String[] args) throws Exception {
final List<String> classNames = getOrderedClassNames();
serializeEnums(writer, classNames);
serializeClasses(writer, classNames);
serializeInterfaces(writer, classNames);
}
private static void serializeEnums(final ILogWriter writer, final List<String> classNames) throws Exception {
for (String c : classNames) {
Expand All @@ -60,10 +61,25 @@ private static List<String> getOrderedClassNames() throws Exception {
classNames.sort(Comparator.naturalOrder());
return classNames;
}
private static void serializeInterfaces(final ILogWriter writer, final List<String> classNames) throws Exception {
for (String c : classNames) {
Class<?> clazz = Class.forName(c);
if(clazz.isInterface()) {
String classHeadLine = "interface " + clazz.getName();
Class<?> superClass = clazz.getSuperclass();
if(superClass != null && superClass != Object.class) {
classHeadLine += " : " + superClass.getName();
}
writer.write(classHeadLine);
serializeFields(clazz, writer);
serializeMethods(clazz, writer);
}
}
}
private static void serializeClasses(final ILogWriter writer, final List<String> classNames) throws Exception {
for (String c : classNames) {
Class<?> clazz = Class.forName(c);
if(!clazz.isEnum()) {
if(!clazz.isEnum() && !clazz.isInterface()) {
String classHeadLine = "class " + clazz.getName();
Class<?> superClass = clazz.getSuperclass();
if(superClass != null && superClass != Object.class) {
Expand Down

0 comments on commit b9d571c

Please sign in to comment.