@@ -40,7 +40,7 @@ public class Protocol extends ResponseObject
4040 private Map <String , String > _availableMetadataInputFormats ;
4141 private String _selectedMetadataInputFormat ;
4242
43- private List <String > _availablePlateTemplates = new ArrayList <>() ;
43+ private List <String > _availablePlateTemplates ;
4444 private String _selectedPlateTemplate ;
4545
4646 private Map <String , String > _protocolParameters ;
@@ -90,31 +90,22 @@ public Protocol(JSONObject json)
9090 _autoCopyTargetContainerId = (String )json .get ("autoCopyTargetContainerId" );
9191
9292 if (json .get ("availableDetectionMethods" ) instanceof JSONArray )
93- {
94- for (Object detectionMethod : (JSONArray )json .get ("availableDetectionMethods" ))
95- _availableDetectionMethods .add ((String )detectionMethod );
96- }
93+ _availableDetectionMethods = new ArrayList <>((JSONArray )json .get ("availableDetectionMethods" ));
9794 if (json .containsKey ("selectedDetectionMethod" ))
9895 _selectedDetectionMethod = (String )json .get ("selectedDetectionMethod" );
99- if (json .containsKey ("availableMetadataInputFormats" ))
100- _availableMetadataInputFormats = ( HashMap <String , String > )json .get ("availableMetadataInputFormats" );
96+ if (json .get ("availableMetadataInputFormats" ) instanceof JSONObject )
97+ _availableMetadataInputFormats = new HashMap <>(( JSONObject )json .get ("availableMetadataInputFormats" ) );
10198 if (json .containsKey ("selectedMetadataInputFormat" ))
10299 _selectedMetadataInputFormat = (String )json .get ("selectedMetadataInputFormat" );
103100 if (json .get ("availablePlateTemplates" ) instanceof JSONArray )
104- {
105- for (Object plateTemplate : (JSONArray )json .get ("availablePlateTemplates" ))
106- _availablePlateTemplates .add ((String )plateTemplate );
107- }
101+ _availablePlateTemplates = new ArrayList <>((JSONArray )json .get ("availablePlateTemplates" ));
108102 if (json .containsKey ("selectedPlateTemplate" ))
109103 _selectedPlateTemplate = (String )json .get ("selectedPlateTemplate" );
110104
111- if (json .get ("protocolTransformScripts" ) instanceof JSONArray )
112- {
113- for (Object transformScript : (JSONArray )json .get ("protocolTransformScripts" ))
114- _protocolTransformScripts .add ((String )transformScript );
115- }
105+ if (json .containsKey ("protocolTransformScripts" ))
106+ _protocolTransformScripts = new ArrayList <>((JSONArray )json .get ("protocolTransformScripts" ));
116107 if (json .containsKey ("protocolParameters" ))
117- _protocolParameters = ( HashMap <String , String >) json .get ("protocolParameters" );
108+ _protocolParameters = new HashMap <>(( JSONObject ) json .get ("protocolParameters" ) );
118109 }
119110
120111 public JSONObject toJSONObject ()
@@ -318,6 +309,11 @@ public String getSelectedDetectionMethod()
318309 return _selectedDetectionMethod ;
319310 }
320311
312+ public Map <String , String > getAvailableMetadataInputFormats ()
313+ {
314+ return _availableMetadataInputFormats ;
315+ }
316+
321317 public Protocol setSelectedMetadataInputFormat (String inputFormat )
322318 {
323319 _selectedMetadataInputFormat = inputFormat ;
0 commit comments