Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added default value if exists #5

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

dnagel21
Copy link

@dnagel21 dnagel21 commented Sep 4, 2017

No description provided.

Copy link
Collaborator

@json-derulo json-derulo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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());
Copy link
Collaborator

@json-derulo json-derulo Sep 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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++) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aktuell ist es so, wenn es mehrere defaultValues gibt, wird nur das letzte genommen.
Kann es überhaupt mehrere geben?

Copy link
Collaborator

@json-derulo json-derulo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improvements and best practices

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants