chore: make code style consistent
This commit is contained in:
parent
a2cea2f33e
commit
89ec3fbf29
380 changed files with 479 additions and 936 deletions
|
|
@ -96,5 +96,4 @@ class AnnotatedMethodService<Context, Result> implements Service<Context, Result
|
|||
public int hashCode() {
|
||||
return Objects.hash(this.methodHandle);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ enum AnnotatedMethodServiceFactory {
|
|||
method.getName(), instance.getClass().getCanonicalName(),
|
||||
method.getParameterCount()
|
||||
));
|
||||
|
||||
}
|
||||
map.put(
|
||||
new AnnotatedMethodService<>(instance, method),
|
||||
|
|
@ -60,5 +59,4 @@ enum AnnotatedMethodServiceFactory {
|
|||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,5 +99,4 @@ public abstract class ChunkedRequestContext<@NonNull Context, @NonNull Result> {
|
|||
return this.requests.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,5 +52,4 @@ public final class PipelineException extends RuntimeException {
|
|||
public PipelineException(final @NonNull String message, final @NonNull Exception cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,5 +51,4 @@ enum ServiceFilterHandler {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,5 +245,4 @@ public final class ServicePipeline {
|
|||
Executor getExecutor() {
|
||||
return this.executor;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,5 +59,4 @@ public final class ServicePipelineBuilder {
|
|||
this.executor = Objects.requireNonNull(executor, "Executor may not be null");
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,5 +70,4 @@ public final class ServicePump<Context> {
|
|||
) {
|
||||
return this.through(TypeToken.get(clazz));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,12 +147,10 @@ public final class ServiceRepository<Context, Response> {
|
|||
@Override
|
||||
public int compareTo(final @NonNull ServiceWrapper<T> other) {
|
||||
return Comparator.<ServiceWrapper<T>>comparingInt(
|
||||
wrapper -> wrapper.isDefaultImplementation()
|
||||
? Integer.MIN_VALUE
|
||||
: Integer.MAX_VALUE).thenComparingInt(wrapper -> wrapper.executionOrder.ordinal())
|
||||
wrapper -> wrapper.isDefaultImplementation()
|
||||
? Integer.MIN_VALUE
|
||||
: Integer.MAX_VALUE).thenComparingInt(wrapper -> wrapper.executionOrder.ordinal())
|
||||
.thenComparingInt(wrapper -> wrapper.registrationOrder).compare(this, other);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,5 +166,4 @@ public final class ServiceSpigot<Context, Result> {
|
|||
public @NonNull CompletableFuture<ServicePump<Result>> forwardAsynchronously() {
|
||||
return this.getResultAsynchronously().thenApply(this.pipeline::pump);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,5 +42,4 @@ public @interface Order {
|
|||
* @return Priority
|
||||
*/
|
||||
ExecutionOrder value() default ExecutionOrder.SOON;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,5 +50,4 @@ public @interface ServiceImplementation {
|
|||
* @return Service to implement
|
||||
*/
|
||||
Class<? extends Service<?, ?>> value();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,5 @@ public interface ConsumerService<Context>
|
|||
public synchronized Throwable initCause(final Throwable cause) {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,5 +58,4 @@ public interface PartialResultService<Context, Result, Chunked extends ChunkedRe
|
|||
* @return Map of request-result pairs
|
||||
*/
|
||||
@NonNull Map<@NonNull Context, @NonNull Result> handleRequests(@NonNull List<Context> requests);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,5 +72,4 @@ public interface Service<Context, Result> extends Function<@NonNull Context, @Nu
|
|||
default @Nullable ExecutionOrder order() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,5 +49,4 @@ public interface SideEffectService<Context> extends Service<Context, State> {
|
|||
*/
|
||||
@Override
|
||||
@NonNull State handle(@NonNull Context context) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ public class ServicesTest {
|
|||
Assertions.assertNotNull(
|
||||
servicePipeline.pump(new MockService.MockContext("oi")).through(MockService.class)
|
||||
.getResultAsynchronously().get());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -281,13 +280,12 @@ public class ServicesTest {
|
|||
);
|
||||
servicePipeline.pump(new MockService.MockContext("pls throw exception"))
|
||||
.through(MockService.class).getResult((result, throwable) -> {
|
||||
Assertions.assertNotNull(throwable);
|
||||
Assertions.assertEquals(
|
||||
DefaultMockService.TotallyIntentionalException.class,
|
||||
throwable.getClass()
|
||||
);
|
||||
Assertions.assertNull(result);
|
||||
});
|
||||
Assertions.assertNotNull(throwable);
|
||||
Assertions.assertEquals(
|
||||
DefaultMockService.TotallyIntentionalException.class,
|
||||
throwable.getClass()
|
||||
);
|
||||
Assertions.assertNull(result);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,5 +31,4 @@ public class AnnotatedMethodTest {
|
|||
public MockService.MockResult handle(final MockService.MockContext context) {
|
||||
return new MockService.MockResult(context.getString().length());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,5 +41,4 @@ public class CompletingPartialResultService implements MockPartialResultService
|
|||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,5 @@ public final class DefaultMockService implements MockService {
|
|||
public static class TotallyIntentionalException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -6277471288867949574L;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,5 +38,4 @@ public class DefaultPartialRequestService implements MockPartialResultService {
|
|||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,5 +32,4 @@ public class DefaultSideEffectService implements MockSideEffectService {
|
|||
mockPlayer.setHealth(0);
|
||||
return State.ACCEPTED;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,5 +31,4 @@ public class InterruptingMockConsumer implements MockConsumerService {
|
|||
public void accept(final MockService.MockContext mockContext) {
|
||||
ConsumerService.interrupt();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ public class MockChunkedRequest
|
|||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -59,7 +58,5 @@ public class MockChunkedRequest
|
|||
public String getSound() {
|
||||
return this.sound;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,5 +33,4 @@ public class MockOrderedFirst implements MockService {
|
|||
public MockResult handle(final MockContext mockContext) {
|
||||
return new MockResult(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,5 +33,4 @@ public class MockOrderedLast implements MockService {
|
|||
public MockResult handle(final MockContext mockContext) {
|
||||
return new MockResult(2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,5 +32,4 @@ public class MockResultConsumer implements SideEffectService<MockService.MockRes
|
|||
public State handle(final MockService.MockResult mockResultConsumer) {
|
||||
return State.ACCEPTED;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ public interface MockService extends Service<MockService.MockContext, MockServic
|
|||
public void setState(final String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class MockResult {
|
||||
|
|
@ -61,7 +60,5 @@ public interface MockService extends Service<MockService.MockContext, MockServic
|
|||
public int getInteger() {
|
||||
return this.integer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,5 @@ public interface MockSideEffectService extends SideEffectService<MockSideEffectS
|
|||
public void setHealth(final int health) {
|
||||
this.health = health;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,5 +36,4 @@ public class SecondaryMockService implements MockService, Predicate<MockService.
|
|||
public boolean test(final MockContext mockContext) {
|
||||
return mockContext.getString().equalsIgnoreCase("potato");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,5 +31,4 @@ public class SecondaryMockSideEffectService implements MockSideEffectService {
|
|||
public State handle(final MockPlayer mockPlayer) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,5 +29,4 @@ public class StateSettingConsumerService implements MockConsumerService {
|
|||
public void accept(final MockService.MockContext mockContext) {
|
||||
mockContext.setState("");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue