8
8
9
9
import static org .jboss .forge .addon .angularjs .AngularJSInspectionResultConstants .JS_IDENTIFIER ;
10
10
import static org .jboss .forge .addon .scaffold .metawidget .inspector .ForgeInspectionResultConstants .PRIMARY_KEY ;
11
- import static org .metawidget .inspector .InspectionResultConstants .*;
11
+ import static org .metawidget .inspector .InspectionResultConstants .DATETIME_TYPE ;
12
+ import static org .metawidget .inspector .InspectionResultConstants .LABEL ;
13
+ import static org .metawidget .inspector .InspectionResultConstants .LOOKUP ;
14
+ import static org .metawidget .inspector .InspectionResultConstants .NAME ;
15
+ import static org .metawidget .inspector .InspectionResultConstants .TYPE ;
12
16
13
17
import java .io .FileNotFoundException ;
14
18
import java .util .ArrayList ;
17
21
import java .util .List ;
18
22
import java .util .Map ;
19
23
20
- import javax .inject .Inject ;
21
24
import javax .persistence .EmbeddedId ;
22
25
import javax .persistence .Id ;
23
26
import javax .persistence .IdClass ;
@@ -50,7 +53,6 @@ public class InspectionResultProcessor
50
53
private MetawidgetInspectorFacade metawidgetInspectorFacade ;
51
54
private Project project ;
52
55
53
- @ Inject
54
56
public InspectionResultProcessor (Project project , MetawidgetInspectorFacade metawidgetInspectorFacade )
55
57
{
56
58
this .project = project ;
@@ -60,12 +62,12 @@ public InspectionResultProcessor(Project project, MetawidgetInspectorFacade meta
60
62
public List <Map <String , String >> enhanceResults (JavaClassSource entity , List <Map <String , String >> inspectionResults )
61
63
{
62
64
Iterator <Map <String , String >> iterInspectionResults = inspectionResults .iterator ();
63
- List <Map <String , String >> additionalPropertyAttributes = new ArrayList <Map < String , String > >();
64
- while (iterInspectionResults .hasNext ())
65
+ List <Map <String , String >> additionalPropertyAttributes = new ArrayList <>();
66
+ while (iterInspectionResults .hasNext ())
65
67
{
66
68
Map <String , String > propertyAttributes = iterInspectionResults .next ();
67
69
// FORGEPLUGINS-120 Omit references to classes having composite keys
68
- if (shouldOmitPropertyWithCompositeKey (propertyAttributes ))
70
+ if (shouldOmitPropertyWithCompositeKey (propertyAttributes ))
69
71
{
70
72
iterInspectionResults .remove ();
71
73
continue ;
@@ -122,7 +124,7 @@ private List<Map<String, String>> expandEmbeddableTypes(Map<String, String> prop
122
124
String embeddedType = propertyAttributes .get (TYPE );
123
125
JavaClassSource javaClass = getJavaClass (embeddedType );
124
126
List <Map <String , String >> embeddedTypeInspectionResults = metawidgetInspectorFacade .inspect (javaClass );
125
- List <Map <String , String >> expandedInspectionResults = new ArrayList <Map < String , String > >();
127
+ List <Map <String , String >> expandedInspectionResults = new ArrayList <>();
126
128
for (Map <String , String > embeddedPropertyAttribute : embeddedTypeInspectionResults )
127
129
{
128
130
embeddedPropertyAttribute .put (LABEL , StringUtils .uncamelCase (embeddedPropertyAttribute .get (NAME )));
@@ -214,7 +216,8 @@ private void chooseRelationshipOptionLabels(JavaClassSource entity, Map<String,
214
216
propertyAttributes .put ("simpleType" , rightHandSideSimpleName );
215
217
JavaClassSource javaClass = getJavaClass (rightHandSideType );
216
218
List <Map <String , String >> rhsInspectionResults = metawidgetInspectorFacade .inspect (javaClass );
217
- List <InspectedProperty > fieldsToDisplay = getPropertiesToDisplay (getDisplayableProperties (rhsInspectionResults ));
219
+ List <InspectedProperty > fieldsToDisplay = getPropertiesToDisplay (
220
+ getDisplayableProperties (rhsInspectionResults ));
218
221
InspectedProperty defaultField = fieldsToDisplay .size () > 0 ? fieldsToDisplay .get (0 ) : null ;
219
222
InspectedProperty fieldToDisplay = defaultField ;
220
223
/*
@@ -229,15 +232,15 @@ private void chooseRelationshipOptionLabels(JavaClassSource entity, Map<String,
229
232
230
233
private List <InspectedProperty > getPropertiesToDisplay (List <Map <String , String >> displayableProperties )
231
234
{
232
- List <InspectedProperty > fieldsToDisplay = new ArrayList <InspectedProperty >();
235
+ List <InspectedProperty > fieldsToDisplay = new ArrayList <>();
233
236
for (Map <String , String > displayableProperty : displayableProperties )
234
237
{
235
238
fieldsToDisplay .add (new InspectedProperty (displayableProperty ));
236
239
}
237
240
return fieldsToDisplay ;
238
241
}
239
242
240
- private boolean shouldOmitPropertyWithCompositeKey (Map <String ,String > propertyAttributes )
243
+ private boolean shouldOmitPropertyWithCompositeKey (Map <String , String > propertyAttributes )
241
244
{
242
245
// Extract simple type name of the relationship types
243
246
boolean isManyToOneRel = Boolean .parseBoolean (propertyAttributes .get ("many-to-one" ));
@@ -302,7 +305,7 @@ public String toString()
302
305
// TODO; Extract this method into it's own class, for unit testing.
303
306
private List <Map <String , String >> getDisplayableProperties (List <Map <String , String >> inspectionResults )
304
307
{
305
- List <Map <String , String >> displayableProperties = new ArrayList <Map < String , String > >();
308
+ List <Map <String , String >> displayableProperties = new ArrayList <>();
306
309
for (Map <String , String > propertyAttributes : inspectionResults )
307
310
{
308
311
canonicalizeTypes (propertyAttributes );
0 commit comments