Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit e015d37

Browse files
committed
added sorted view by method and field names
1 parent b35ebf1 commit e015d37

File tree

3 files changed

+35
-6
lines changed

3 files changed

+35
-6
lines changed

ClassySharkWS/src/com/google/classyshark/Version.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
public class Version {
2323

2424
public static final int MAJOR = 8;
25-
public static final int MINOR = 0;
25+
public static final int MINOR = 1;
2626
}

ClassySharkWS/src/com/google/classyshark/silverghost/translator/java/JavaTranslator.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
import com.google.classyshark.silverghost.translator.TranslatorFactory;
2222
import com.google.classyshark.silverghost.translator.java.clazz.QualifiedTypesMap;
2323
import com.google.classyshark.silverghost.translator.java.clazz.reflect.MetaObjectClass;
24-
2524
import java.io.File;
2625
import java.lang.reflect.Modifier;
2726
import java.util.ArrayList;
27+
import java.util.Arrays;
2828
import java.util.Collections;
2929
import java.util.List;
3030

@@ -227,7 +227,11 @@ private static void fillFields(MetaObject.FieldInfo[] fields,
227227
+ " //======================== F I E L D S ==================\n\n",
228228
TAG.DOCUMENT));
229229

230-
for (MetaObject.FieldInfo field : fields) {
230+
List<MetaObject.FieldInfo> sortedFields =
231+
Arrays.asList(fields);
232+
Collections.sort(sortedFields);
233+
234+
for (MetaObject.FieldInfo field : sortedFields) {
231235
int md = field.modifiers;
232236
annotations = field.annotations;
233237

@@ -286,7 +290,11 @@ private static void fillMethods(MetaObject.MethodInfo[] methods,
286290
+ " //======================== M E T H O D S ================\n\n",
287291
TAG.DOCUMENT));
288292

289-
for (MetaObject.MethodInfo method : methods) {
293+
List<MetaObject.MethodInfo> sortedMethods =
294+
Arrays.asList(methods);
295+
Collections.sort(sortedMethods);
296+
297+
for (MetaObject.MethodInfo method : sortedMethods) {
290298
int md = method.modifiers;
291299

292300
annotations = method.annotations;

ClassySharkWS/src/com/google/classyshark/silverghost/translator/java/MetaObject.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,22 @@ public static class InterfaceInfo {
3232
/**
3333
* data class for fields
3434
*/
35-
public static class FieldInfo {
35+
public static class FieldInfo implements Comparable {
3636
public String typeName;
3737
public int modifiers;
3838
public AnnotationInfo[] annotations;
3939
public String name;
4040
public String genericStr = "";
41+
42+
@Override
43+
public int compareTo(Object o) {
44+
if(o instanceof FieldInfo) {
45+
FieldInfo other = (FieldInfo)o;
46+
return this.name.compareTo(other.name);
47+
}
48+
49+
return 0;
50+
}
4151
}
4252

4353
/**
@@ -52,14 +62,25 @@ public static class ConstructorInfo {
5262
/**
5363
* data class for methods
5464
*/
55-
public static class MethodInfo {
65+
public static class MethodInfo implements Comparable{
5666
public AnnotationInfo[] annotations;
5767
public ParameterInfo[] parameterTypes;
5868
public int modifiers;
5969
public String name;
6070
public ExceptionInfo[] exceptionTypes;
6171
public String returnType;
6272
public String genericReturnType = "";
73+
74+
@Override
75+
public int compareTo(Object o) {
76+
77+
if(o instanceof MethodInfo) {
78+
MethodInfo other = (MethodInfo)o;
79+
return this.name.compareTo(other.name);
80+
}
81+
82+
return 0;
83+
}
6384
}
6485

6586
/**

0 commit comments

Comments
 (0)