Added default value if exists#5
Conversation
json-derulo
left a comment
There was a problem hiding this comment.
Format the code indentations properly
| Matcher m = Pattern.compile(Regex.GETMETHODHEADERPARAMETER).matcher(paramUnformatted); | ||
| while (m.find() && isDefaultValue) { | ||
| List<String> paramUnformattedTest = new ArrayList<String>(); | ||
| paramUnformattedTest.add(m.group()); |
There was a problem hiding this comment.
Die Liste paramUnformattedTest enthält höchstens einen Wert. Du kannst mit dem String direkt arbeiten.
| paramUnformattedTest.add(m.group()); | ||
| for (int i = 0; i < paramUnformattedTest.size(); i++) { | ||
| if (paramUnformattedTest.get(i).contains("@DefaultValue")) { | ||
| createMapFromParameters(paramUnformatted); |
There was a problem hiding this comment.
Die Methode gibt eine Map zurück, der Rückgabewert wird aber nie verwendet.
|
|
||
| String param = paramUnformatted.replaceAll("[\\s]*" + Regex.ANNOTATION + "[\\s]*", "").trim(); | ||
|
|
||
| List<String> defaultValue = new ArrayList<String>(); |
There was a problem hiding this comment.
Namensgebung: Damit man direkt sehen kann, dass es mehrere Werte sind, lieber umbenennen zu defaultValues
| if (isDefaultValue) { | ||
| parameter.setLocation("query"); | ||
| // parameter.setType(type); | ||
| for (int i = 0; i < defaultValue.size(); i++) { |
There was a problem hiding this comment.
Ich bevorzuge for-Schleifen mit der Doppelpunkt-Schreibweise
for (String value: defaultValue) { }
| parameter.setLocation("query"); | ||
| // parameter.setType(type); | ||
| for (int i = 0; i < defaultValue.size(); i++) { | ||
| parameter.setDefaultValue(defaultValue.get(i)); |
There was a problem hiding this comment.
Aktuell ist es so, wenn es mehrere defaultValues gibt, wird nur das letzte genommen.
Kann es überhaupt mehrere geben?
json-derulo
left a comment
There was a problem hiding this comment.
improvements and best practices
No description provided.