net.jbock.annotated.AnnotatedParameters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jbock-compiler Show documentation
Show all versions of jbock-compiler Show documentation
jbock annotation processor
package net.jbock.annotated;
import net.jbock.common.EnumName;
import net.jbock.common.SnakeName;
import java.util.Locale;
import java.util.stream.Stream;
public final class AnnotatedParameters extends AnnotatedMethod {
private final ExecutableParameters parameters;
private AnnotatedParameters(
EnumName enumName,
ExecutableParameters parameters,
String paramLabel) {
super(enumName, paramLabel);
this.parameters = parameters;
}
static AnnotatedParameters createParameters(
ExecutableParameters parameters,
EnumName enumName) {
String paramLabel = parameters.paramLabel()
.orElseGet(() -> SnakeName.create(parameters.simpleName().toString())
.snake('_')
.toUpperCase(Locale.US));
return new AnnotatedParameters(enumName, parameters, paramLabel);
}
@Override
Executable executable() {
return parameters;
}
@Override
public boolean isParameter() {
return false;
}
@Override
public boolean isParameters() {
return true;
}
@Override
Stream asAnnotatedOption() {
return Stream.empty();
}
@Override
Stream asAnnotatedParameter() {
return Stream.empty();
}
@Override
Stream asAnnotatedParameters() {
return Stream.of(this);
}
}