Skip to content

Commit

Permalink
prevent duplicate constants
Browse files Browse the repository at this point in the history
  • Loading branch information
SentryMan committed Oct 20, 2023
1 parent 3d53d55 commit 0bcbf1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import static java.util.stream.Collectors.toMap;

import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand All @@ -35,6 +36,7 @@ class ClientMethodWriter {
private final Optional<RequestTimeoutPrism> timeout;
private final boolean useConfig;
private final Map<String, String> segmentPropertyMap;
private final Set<String> propertyConstants = new HashSet<>();

ClientMethodWriter(MethodReader method, Append writer, boolean useJsonb) {
this.method = method;
Expand Down Expand Up @@ -76,6 +78,11 @@ private void methodStart(Append writer) {

segmentPropertyMap.forEach(
(k, v) -> {

if (!propertyConstants.add(v)) {
return;
}

writer.append(" private static final String %s = ", v);
final String getProperty = useConfig ? "Config.get(" : "System.getProperty(";
writer.append(getProperty).append("\"%s\");", k).eol();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
public interface TitanFall {

@Get("/${titan}/${drop.point}")
Titan titanfall();
Titan titanFall();


@Get("/${titan}/copium")
Titan titanFall3();
}

0 comments on commit 0bcbf1a

Please sign in to comment.