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

Refactoring/Small changes #92

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/main/java/com/microsoft/bingads/ApiEnvironment.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.microsoft.bingads;

import java.util.Arrays;

/**
* Represents Bing Ads API environment (Production or Sandbox).
*/
Expand All @@ -26,11 +28,7 @@ public String value() {
}

public static ApiEnvironment fromValue(String v) {
for (ApiEnvironment c : ApiEnvironment.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
return Arrays.stream(values()).filter((env) -> env.value.equals(v)).findFirst()
.orElseThrow(() -> new IllegalArgumentException(v));
}
}
1 change: 1 addition & 0 deletions src/main/java/com/microsoft/bingads/AsyncCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @param <T> the type of result
*/
@FunctionalInterface
public interface AsyncCallback<T> {

/**
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/com/microsoft/bingads/ServiceClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ public List<Handler> getHandlerChain(PortInfo portInfo) {
}
});

T port = serviceFactory.createProxyFromService(service, environment, serviceInterface);

return port;
return serviceFactory.createProxyFromService(service, environment, serviceInterface);
}

private void refreshOAuthTokensIfNeeded() {
Expand Down