🚚 More removal of javax annotations
This commit is contained in:
parent
4556b392b0
commit
26f11e3a7e
47 changed files with 594 additions and 691 deletions
|
|
@ -36,9 +36,9 @@ import cloud.commandframework.meta.CommandMeta;
|
|||
import cloud.commandframework.meta.SimpleCommandMeta;
|
||||
import io.leangen.geantyref.TypeToken;
|
||||
import cloud.commandframework.arguments.parser.ParserParameters;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Parameter;
|
||||
|
|
@ -75,9 +75,9 @@ public final class AnnotationParser<C> {
|
|||
* {@link ParserParameter}. Mappers for the
|
||||
* parser parameters can be registered using {@link #registerAnnotationMapper(Class, Function)}
|
||||
*/
|
||||
public AnnotationParser(@Nonnull final CommandManager<C> manager,
|
||||
@Nonnull final Class<C> commandSenderClass,
|
||||
@Nonnull final Function<ParserParameters, CommandMeta> metaMapper) {
|
||||
public AnnotationParser(@NonNull final CommandManager<C> manager,
|
||||
@NonNull final Class<C> commandSenderClass,
|
||||
@NonNull final Function<@NonNull ParserParameters, @NonNull CommandMeta> metaMapper) {
|
||||
this.commandSenderClass = commandSenderClass;
|
||||
this.manager = manager;
|
||||
this.metaFactory = new MetaFactory(this, metaMapper);
|
||||
|
|
@ -93,8 +93,9 @@ public final class AnnotationParser<C> {
|
|||
* @param mapper Mapping function
|
||||
* @param <A> Annotation type
|
||||
*/
|
||||
public <A extends Annotation> void registerAnnotationMapper(@Nonnull final Class<A> annotation,
|
||||
@Nonnull final Function<A, ParserParameters> mapper) {
|
||||
public <A extends Annotation> void registerAnnotationMapper(@NonNull final Class<A> annotation,
|
||||
@NonNull final Function<@NonNull A,
|
||||
@NonNull ParserParameters> mapper) {
|
||||
this.annotationMappers.put(annotation, mapper);
|
||||
}
|
||||
|
||||
|
|
@ -106,8 +107,7 @@ public final class AnnotationParser<C> {
|
|||
* @param <T> Type of the instance
|
||||
* @return Collection of parsed annotations
|
||||
*/
|
||||
@Nonnull
|
||||
public <T> Collection<Command<C>> parse(@Nonnull final T instance) {
|
||||
public <T> @NonNull Collection<@NonNull Command<C>> parse(@NonNull final T instance) {
|
||||
final Method[] methods = instance.getClass().getDeclaredMethods();
|
||||
final Collection<CommandMethodPair> commandMethodPairs = new ArrayList<>();
|
||||
for (final Method method : methods) {
|
||||
|
|
@ -133,10 +133,10 @@ public final class AnnotationParser<C> {
|
|||
return commands;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@SuppressWarnings("unchecked")
|
||||
private Collection<Command<C>> construct(@Nonnull final Object instance,
|
||||
@Nonnull final Collection<CommandMethodPair> methodPairs) {
|
||||
private @NonNull Collection<@NonNull Command<C>> construct(
|
||||
@NonNull final Object instance,
|
||||
@NonNull final Collection<@NonNull CommandMethodPair> methodPairs) {
|
||||
final Collection<Command<C>> commands = new ArrayList<>();
|
||||
for (final CommandMethodPair commandMethodPair : methodPairs) {
|
||||
final CommandMethod commandMethod = commandMethodPair.getCommandMethod();
|
||||
|
|
@ -239,11 +239,10 @@ public final class AnnotationParser<C> {
|
|||
return commands;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@SuppressWarnings("unchecked")
|
||||
private CommandArgument<C, ?> buildArgument(@Nonnull final Method method,
|
||||
@Nullable final SyntaxFragment syntaxFragment,
|
||||
@Nonnull final ArgumentParameterPair argumentPair) {
|
||||
private @NonNull CommandArgument<C, ?> buildArgument(@NonNull final Method method,
|
||||
@Nullable final SyntaxFragment syntaxFragment,
|
||||
@NonNull final ArgumentParameterPair argumentPair) {
|
||||
final Parameter parameter = argumentPair.getParameter();
|
||||
final Collection<Annotation> annotations = Arrays.asList(parameter.getAnnotations());
|
||||
final TypeToken<?> token = TypeToken.get(parameter.getParameterizedType());
|
||||
|
|
@ -291,8 +290,8 @@ public final class AnnotationParser<C> {
|
|||
return argumentBuilder.manager(this.manager).withParser(parser).build();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
Map<Class<? extends Annotation>, Function<? extends Annotation, ParserParameters>> getAnnotationMappers() {
|
||||
@NonNull Map<@NonNull Class<@NonNull ? extends Annotation>,
|
||||
@NonNull Function<@NonNull ? extends Annotation, @NonNull ParserParameters>> getAnnotationMappers() {
|
||||
return this.annotationMappers;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue