Skip to content

Commit

Permalink
#1714: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
t1 authored and jmartisk committed Feb 6, 2023
1 parent e49a579 commit 7ab7d94
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public OperationType getOperationType() {
return OperationType.QUERY;
}

@Override
public String getName() {
return queryName()
.orElseGet(() -> mutationName()
Expand Down Expand Up @@ -93,17 +94,14 @@ private Optional<String> subscriptionName() {
return Optional.empty();
}

@Override
public String getRawName() {
String name = method.getName();
if (name.startsWith("get") && name.length() > 3 && Character.isUpperCase(name.charAt(3)))
return Character.toLowerCase(name.charAt(3)) + name.substring(4);
return name;
}

public boolean isRenamed() {
return !getName().equals(getRawName());
}

public TypeInfo getReturnType() {
return new TypeInfo(type, method.getGenericReturnType(), method.getAnnotatedReturnType());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ public interface NamedElement {

String getRawName();

boolean isRenamed();
default boolean isRenamed() {
return !getName().equals(getRawName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,6 @@ public String getRawName() {
return parameter.getName();
}

@Override
public boolean isRenamed() {
return !getName().equals(getRawName());
}

public <A extends Annotation> A[] getAnnotations(Class<A> type) {
return parameter.getAnnotationsByType(type);
}
Expand Down

0 comments on commit 7ab7d94

Please sign in to comment.