17
17
package org .metafacture .flux ;
18
18
19
19
import org .metafacture .commons .ResourceUtil ;
20
+ import org .metafacture .commons .reflection .ConfigurableClass ;
20
21
import org .metafacture .commons .reflection .ObjectFactory ;
21
22
import org .metafacture .framework .MetafactureException ;
22
23
import org .metafacture .framework .annotations .Description ;
@@ -80,8 +81,9 @@ private static String getVersionInfo() {
80
81
}
81
82
}
82
83
83
- private static <T > void describe (final String name , final ObjectFactory <T > factory , final PrintStream out ) {
84
- final Class <? extends T > moduleClass = factory .get (name ).getPlainClass ();
84
+ private static <T > void describe (final String name , final ObjectFactory <T > factory , final PrintStream out ) { // checkstyle-disable-line ExecutableStatementCount
85
+ final ConfigurableClass <? extends T > configurableClass = factory .get (name );
86
+ final Class <? extends T > moduleClass = configurableClass .getPlainClass ();
85
87
final Description desc = moduleClass .getAnnotation (Description .class );
86
88
87
89
out .println (name );
@@ -96,22 +98,29 @@ private static <T> void describe(final String name, final ObjectFactory<T> facto
96
98
out .println ("- arguments:\t " + arguments );
97
99
}
98
100
99
- final Map <String , Class <?>> attributes = factory . get ( name ). getSetterTypes ();
101
+ final Map <String , Method > attributes = configurableClass . getSetters ();
100
102
101
103
if (!attributes .isEmpty ()) {
102
104
out .print ("- options:\t " );
103
105
final StringBuilder builder = new StringBuilder ();
104
- for (final Entry <String , Class <?>> entry : attributes .entrySet ()) {
105
- if (entry .getValue ().isEnum ()) {
106
+ for (final Entry <String , Method > entry : attributes .entrySet ()) {
107
+ final Method method = entry .getValue ();
108
+ final Class <?> type = configurableClass .getSetterType (method );
109
+
110
+ if (method .isAnnotationPresent (Deprecated .class )) {
111
+ builder .append ("[deprecated] " );
112
+ }
113
+
114
+ if (type .isEnum ()) {
106
115
builder .append (entry .getKey ())
107
116
.append (" " )
108
- .append (Arrays .asList (entry . getValue () .getEnumConstants ()))
117
+ .append (Arrays .asList (type .getEnumConstants ()))
109
118
.append (", " );
110
119
}
111
120
else {
112
121
builder .append (entry .getKey ())
113
122
.append (" (" )
114
- .append (entry . getValue () .getSimpleName ())
123
+ .append (type .getSimpleName ())
115
124
.append ("), " );
116
125
}
117
126
0 commit comments