com.slimgears.apt.data.HasParameters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apt-utils Show documentation
Show all versions of apt-utils Show documentation
General purpose utils / module: apt-utils
/**
*
*/
package com.slimgears.apt.data;
import com.google.common.collect.ImmutableList;
import javax.lang.model.element.ExecutableElement;
import java.util.stream.Stream;
public interface HasParameters {
ImmutableList params();
@SuppressWarnings("unchecked")
interface Builder> {
ImmutableList.Builder paramsBuilder();
default B addParam(ParamInfo param) {
paramsBuilder().add(param);
return (B)this;
}
default B addParam(String name, TypeInfo type) {
return addParam(ParamInfo.create(name, type));
}
default B params(Stream params) {
params.forEach(this::addParam);
return (B)this;
}
default B paramsFromMethod(ExecutableElement executableElement) {
executableElement.getParameters().forEach(v -> addParam(ParamInfo.of(v)));
return (B)this;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy