⚡ Fix dependency graph and replace Guava
This commit is contained in:
parent
4ca47777a3
commit
e914d04450
35 changed files with 184 additions and 191 deletions
|
|
@ -23,7 +23,6 @@
|
|||
//
|
||||
package cloud.commandframework.services;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import cloud.commandframework.services.annotations.Order;
|
||||
import cloud.commandframework.services.types.Service;
|
||||
|
||||
|
|
@ -32,6 +31,7 @@ import javax.annotation.Nullable;
|
|||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Objects;
|
||||
|
||||
class AnnotatedMethodService<Context, Result> implements Service<Context, Result> {
|
||||
|
||||
|
|
@ -87,12 +87,12 @@ class AnnotatedMethodService<Context, Result> implements Service<Context, Result
|
|||
return false;
|
||||
}
|
||||
final AnnotatedMethodService<?, ?> that = (AnnotatedMethodService<?, ?>) o;
|
||||
return Objects.equal(this.methodHandle, that.methodHandle);
|
||||
return Objects.equals(this.methodHandle, that.methodHandle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(this.methodHandle);
|
||||
return Objects.hash(this.methodHandle);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
//
|
||||
package cloud.commandframework.services;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import io.leangen.geantyref.TypeToken;
|
||||
import cloud.commandframework.services.annotations.ServiceImplementation;
|
||||
import cloud.commandframework.services.types.Service;
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ enum AnnotatedMethodServiceFactory {
|
|||
|
||||
}
|
||||
map.put(new AnnotatedMethodService<>(instance, method),
|
||||
TypeToken.of(serviceImplementation.value()));
|
||||
TypeToken.get(serviceImplementation.value()));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
//
|
||||
package cloud.commandframework.services;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import io.leangen.geantyref.TypeToken;
|
||||
import cloud.commandframework.services.types.Service;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
|
@ -166,7 +166,7 @@ public final class ServicePipeline {
|
|||
@Nonnull final Class<? extends Service<Context, Result>> type,
|
||||
@Nonnull final Service<Context, Result> implementation,
|
||||
@Nonnull final Collection<Predicate<Context>> filters) {
|
||||
return registerServiceImplementation(TypeToken.of(type), implementation, filters);
|
||||
return registerServiceImplementation(TypeToken.get(type), implementation, filters);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -227,7 +227,7 @@ public final class ServicePipeline {
|
|||
Collections.reverse(queue);
|
||||
for (ServiceRepository<Context, Result>.ServiceWrapper<? extends Service<Context, Result>> wrapper : queue) {
|
||||
collection
|
||||
.add((TypeToken<? extends S>) TypeToken.of(wrapper.getImplementation().getClass()));
|
||||
.add((TypeToken<? extends S>) TypeToken.get(wrapper.getImplementation().getClass()));
|
||||
}
|
||||
return Collections.unmodifiableList(collection);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,8 @@
|
|||
//
|
||||
package cloud.commandframework.services;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
|
|
@ -59,7 +58,7 @@ public final class ServicePipelineBuilder {
|
|||
*/
|
||||
@Nonnull
|
||||
public ServicePipelineBuilder withExecutor(@Nonnull final Executor executor) {
|
||||
this.executor = Preconditions.checkNotNull(executor, "Executor may not be null");
|
||||
this.executor = Objects.requireNonNull(executor, "Executor may not be null");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
//
|
||||
package cloud.commandframework.services;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import cloud.commandframework.services.types.Service;
|
||||
import io.leangen.geantyref.TypeToken;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ public final class ServicePump<Context> {
|
|||
@Nonnull
|
||||
public <Result> ServiceSpigot<Context, Result> through(
|
||||
@Nonnull final Class<? extends Service<Context, Result>> clazz) {
|
||||
return this.through(TypeToken.of(clazz));
|
||||
return this.through(TypeToken.get(clazz));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
//
|
||||
package cloud.commandframework.services;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import io.leangen.geantyref.TypeToken;
|
||||
import cloud.commandframework.services.annotations.Order;
|
||||
import cloud.commandframework.services.types.Service;
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ public final class ServiceRepository<Context, Response> {
|
|||
public String toString() {
|
||||
return String
|
||||
.format("ServiceWrapper{type=%s,implementation=%s}", serviceType.toString(),
|
||||
TypeToken.of(implementation.getClass()).toString());
|
||||
TypeToken.get(implementation.getClass()).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
//
|
||||
package cloud.commandframework.services;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import io.leangen.geantyref.TypeToken;
|
||||
import cloud.commandframework.services.types.ConsumerService;
|
||||
import cloud.commandframework.services.types.Service;
|
||||
import cloud.commandframework.services.types.SideEffectService;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue