pocketknife.internal.codegen.MethodBinding Maven / Gradle / Ivy
package pocketknife.internal.codegen;
import com.squareup.javapoet.MethodSpec;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
public abstract class MethodBinding {
public abstract List extends FieldBinding> getFields();
public abstract Set getKeys();
public abstract MethodSpec generateMethodSpec(TypeUtil typeUtil);
protected String getReturnVarName(String returnVarNameRoot) {
Set fieldNames = new LinkedHashSet();
for (FieldBinding fieldBinding : getFields()) {
fieldNames.add(fieldBinding.getName());
}
String returnVarName = returnVarNameRoot;
int count = 0;
while (fieldNames.contains(returnVarName)) {
returnVarName = returnVarNameRoot + ++count;
}
return returnVarName;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy