net.jbock.annotated.AnnotatedMethod 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.ValidationFailure;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.TypeMirror;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
public abstract class AnnotatedMethod {
private final EnumName enumName;
private final String paramLabel;
AnnotatedMethod(
EnumName enumName,
String paramLabel) {
this.enumName = enumName;
this.paramLabel = paramLabel;
}
abstract Executable executable();
public abstract boolean isParameter();
public abstract boolean isParameters();
abstract Stream asAnnotatedOption();
abstract Stream asAnnotatedParameter();
abstract Stream asAnnotatedParameters();
public final EnumName enumName() {
return enumName;
}
public final String methodName() {
return method().getSimpleName().toString();
}
public final TypeMirror returnType() {
return method().getReturnType();
}
public final String paramLabel() {
return paramLabel;
}
public final List accessModifiers() {
return executable().accessModifiers();
}
public final Optional converter() {
return executable().converter();
}
public final ValidationFailure fail(String message) {
return executable().fail(message);
}
public final ExecutableElement method() {
return executable().method();
}
public final Optional descriptionKey() {
return executable().descriptionKey();
}
public final List description() {
return executable().description();
}
}