diff --git a/common/src/main/java/net/infumia/frame/injection/InjectionServiceInjector.java b/common/src/main/java/net/infumia/frame/injection/InjectionServiceInjector.java index ac4a4d2..d7fa410 100644 --- a/common/src/main/java/net/infumia/frame/injection/InjectionServiceInjector.java +++ b/common/src/main/java/net/infumia/frame/injection/InjectionServiceInjector.java @@ -18,6 +18,7 @@ public final class InjectionServiceInjector implements InjectionService { this.registry = registry; } + @NotNull @Override public String key() { return InjectionServiceInjector.KEY; diff --git a/common/src/main/java/net/infumia/frame/pipeline/PipelineBase.java b/common/src/main/java/net/infumia/frame/pipeline/PipelineBase.java index 2f3c699..a3401e1 100644 --- a/common/src/main/java/net/infumia/frame/pipeline/PipelineBase.java +++ b/common/src/main/java/net/infumia/frame/pipeline/PipelineBase.java @@ -1,15 +1,13 @@ package net.infumia.frame.pipeline; -import java.util.Collection; import java.util.concurrent.CompletableFuture; -import java.util.function.Predicate; -import java.util.function.UnaryOperator; import net.infumia.frame.service.Implementation; import net.infumia.frame.service.Service; +import net.infumia.frame.util.Cloned; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -public interface PipelineBase> { +public interface PipelineBase> + extends Cloned { @NotNull Self apply(@NotNull Implementation operation); @@ -23,63 +21,4 @@ public interface PipelineBase service) { return this.apply(Implementation.register(service)); } - - @NotNull - default Self register( - @NotNull final Service service, - @Nullable final Collection> filters - ) { - return this.apply(Implementation.register(service, filters)); - } - - @NotNull - default Self replace( - @NotNull final String serviceKey, - @NotNull final UnaryOperator> operation - ) { - return this.apply(Implementation.replace(serviceKey, operation)); - } - - @NotNull - default Self replace( - @NotNull final String serviceKey, - @NotNull final UnaryOperator> operation, - @Nullable final Collection> filters - ) { - return this.apply(Implementation.replace(serviceKey, operation, filters)); - } - - @NotNull - default Self registerAfter( - @NotNull final String serviceKey, - @NotNull final Service service - ) { - return this.apply(Implementation.registerAfter(serviceKey, service)); - } - - @NotNull - default Self registerAfter( - @NotNull final String serviceKey, - @NotNull final Service service, - @Nullable final Collection> filters - ) { - return this.apply(Implementation.registerAfter(serviceKey, service, filters)); - } - - @NotNull - default Self registerBefore( - @NotNull final String serviceKey, - @NotNull final Service service - ) { - return this.apply(Implementation.registerBefore(serviceKey, service)); - } - - @NotNull - default Self registerBefore( - @NotNull final String serviceKey, - @NotNull final Service service, - @Nullable final Collection> filters - ) { - return this.apply(Implementation.registerBefore(serviceKey, service, filters)); - } } diff --git a/common/src/main/java/net/infumia/frame/service/Implementation.java b/common/src/main/java/net/infumia/frame/service/Implementation.java index aa4328e..9c91221 100644 --- a/common/src/main/java/net/infumia/frame/service/Implementation.java +++ b/common/src/main/java/net/infumia/frame/service/Implementation.java @@ -7,6 +7,13 @@ import org.jetbrains.annotations.Nullable; public interface Implementation { + @NotNull + static Implementation remove( + @NotNull final String serviceKey + ) { + return new Remove<>(serviceKey); + } + @NotNull static Implementation register( @NotNull final Service service, diff --git a/common/src/main/java/net/infumia/frame/service/RegisterAfter.java b/common/src/main/java/net/infumia/frame/service/RegisterAfter.java index 30f33f7..234d76a 100644 --- a/common/src/main/java/net/infumia/frame/service/RegisterAfter.java +++ b/common/src/main/java/net/infumia/frame/service/RegisterAfter.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.function.Predicate; import java.util.stream.Collectors; -import net.infumia.frame.util.Keyed; import net.infumia.frame.util.Preconditions; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -50,7 +49,7 @@ public void handle(@NotNull final ServiceRepository repository) implementations .stream() .map(wrapper -> wrapper.implementation) - .map(Keyed::key) + .map(Service::key) .collect(Collectors.toSet()) ) ); diff --git a/common/src/main/java/net/infumia/frame/service/RegisterBefore.java b/common/src/main/java/net/infumia/frame/service/RegisterBefore.java index 4bfa40f..40a0413 100644 --- a/common/src/main/java/net/infumia/frame/service/RegisterBefore.java +++ b/common/src/main/java/net/infumia/frame/service/RegisterBefore.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.ListIterator; import java.util.function.Predicate; +import java.util.stream.Collectors; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -42,6 +43,10 @@ public void handle(@NotNull final ServiceRepository repository) "Service '%s' not found in the implementation list '%s'!", this.serviceKey, implementations + .stream() + .map(wrapper -> wrapper.implementation) + .map(Service::key) + .collect(Collectors.toSet()) ) ); } diff --git a/common/src/main/java/net/infumia/frame/service/Remove.java b/common/src/main/java/net/infumia/frame/service/Remove.java new file mode 100644 index 0000000..5837995 --- /dev/null +++ b/common/src/main/java/net/infumia/frame/service/Remove.java @@ -0,0 +1,19 @@ +package net.infumia.frame.service; + +import org.jetbrains.annotations.NotNull; + +final class Remove implements Implementation { + + private final String serviceKey; + + Remove(@NotNull final String serviceKey) { + this.serviceKey = serviceKey; + } + + @Override + public void handle(@NotNull final ServiceRepository repository) { + repository.implementations.removeIf(wrapper -> + wrapper.implementation.key().equals(this.serviceKey) + ); + } +} diff --git a/common/src/main/java/net/infumia/frame/service/Replace.java b/common/src/main/java/net/infumia/frame/service/Replace.java index a935347..32cb218 100644 --- a/common/src/main/java/net/infumia/frame/service/Replace.java +++ b/common/src/main/java/net/infumia/frame/service/Replace.java @@ -6,7 +6,6 @@ import java.util.function.Predicate; import java.util.function.UnaryOperator; import java.util.stream.Collectors; -import net.infumia.frame.util.Keyed; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -52,7 +51,7 @@ public void handle(@NotNull final ServiceRepository repository) implementations .stream() .map(wrapper -> wrapper.implementation) - .map(Keyed::key) + .map(Service::key) .collect(Collectors.toSet()) ) ); diff --git a/common/src/main/java/net/infumia/frame/service/Service.java b/common/src/main/java/net/infumia/frame/service/Service.java index de3c530..977dde3 100644 --- a/common/src/main/java/net/infumia/frame/service/Service.java +++ b/common/src/main/java/net/infumia/frame/service/Service.java @@ -1,10 +1,12 @@ package net.infumia.frame.service; import java.util.concurrent.CompletableFuture; -import net.infumia.frame.util.Keyed; import org.jetbrains.annotations.NotNull; -public interface Service extends Keyed { +public interface Service { @NotNull CompletableFuture handle(Context context); + + @NotNull + String key(); } diff --git a/common/src/main/java/net/infumia/frame/service/ServiceRepository.java b/common/src/main/java/net/infumia/frame/service/ServiceRepository.java index 73b4450..e3cdae6 100644 --- a/common/src/main/java/net/infumia/frame/service/ServiceRepository.java +++ b/common/src/main/java/net/infumia/frame/service/ServiceRepository.java @@ -5,11 +5,14 @@ import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; +import net.infumia.frame.util.Cloned; import org.jetbrains.annotations.NotNull; -public final class ServiceRepository { +public final class ServiceRepository + implements Cloned> { private final ServicePipeline pipeline; + private final Service defaultImplementation; final List> implementations; final TypeToken> serviceType; @@ -20,12 +23,19 @@ public ServiceRepository( ) { this.pipeline = pipeline; this.serviceType = serviceType; + this.defaultImplementation = defaultImplementation; this.implementations = new LinkedList<>(); this.implementations.add( new ServiceWrapper<>(serviceType, defaultImplementation, true, null) ); } + @NotNull + @Override + public ServiceRepository cloned() { + return new ServiceRepository<>(this.pipeline, this.serviceType, this.defaultImplementation); + } + public void apply(@NotNull final Implementation operation) { synchronized (this.implementations) { operation.handle(this); diff --git a/common/src/main/java/net/infumia/frame/util/Cloned.java b/common/src/main/java/net/infumia/frame/util/Cloned.java new file mode 100644 index 0000000..19023b0 --- /dev/null +++ b/common/src/main/java/net/infumia/frame/util/Cloned.java @@ -0,0 +1,8 @@ +package net.infumia.frame.util; + +import org.jetbrains.annotations.NotNull; + +public interface Cloned> { + @NotNull + S cloned(); +} diff --git a/core/src/main/java/net/infumia/frame/FrameImpl.java b/core/src/main/java/net/infumia/frame/FrameImpl.java index a8ab302..e0e3d86 100644 --- a/core/src/main/java/net/infumia/frame/FrameImpl.java +++ b/core/src/main/java/net/infumia/frame/FrameImpl.java @@ -134,7 +134,7 @@ public void register( ) { Preconditions.state( !this.registered.get(), - "This inventory manager is already registered! #register() method cannot be called twice!" + "This frame is already registered! #register() method cannot be called twice!" ); this.registered.set(true); this.executeViewCreation(this.unregisteredViews, instanceConfigurer) @@ -172,7 +172,7 @@ public void unregister() { @NotNull @Override public Frame with(@NotNull final Class viewClass) { - Preconditions.argument(!this.registered.get(), "This inventory manager is registered!"); + Preconditions.argument(!this.registered.get(), "This frame is registered!"); this.intoUnregisteredViews(viewClass); return this; } @@ -264,7 +264,7 @@ public PipelineExecutorFrame pipelines() { private View findView(@NotNull final Class viewClass) { Preconditions.state( this.registered.get(), - "Before you open a view you must register this inventory manager!" + "Before you open a view you must register this frame!" ); return Preconditions.argumentNotNull( this.registeredViews.get(viewClass), diff --git a/core/src/main/java/net/infumia/frame/pipeline/PipelineConsumerImpl.java b/core/src/main/java/net/infumia/frame/pipeline/PipelineConsumerImpl.java index 4e4ba79..499c3ce 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/PipelineConsumerImpl.java +++ b/core/src/main/java/net/infumia/frame/pipeline/PipelineConsumerImpl.java @@ -12,11 +12,17 @@ public final class PipelineConsumerImpl implements Pi private final ServiceRepository repository; + private PipelineConsumerImpl( + @NotNull final ServiceRepository repository + ) { + this.repository = repository; + } + public PipelineConsumerImpl( @NotNull final TypeToken> type, @NotNull final PipelineServiceConsumer defaultService ) { - this.repository = ServicePipelineBuilder.newBuilder().build().create(type, defaultService); + this(ServicePipelineBuilder.newBuilder().build().create(type, defaultService)); } @NotNull @@ -39,4 +45,10 @@ public CompletableFuture completeWith(@NotNull final B co public CompletableFuture completeWithAsync(@NotNull final B context) { return this.repository.completeWithAsync(context); } + + @NotNull + @Override + public PipelineConsumer cloned() { + return new PipelineConsumerImpl<>(this.repository.cloned()); + } } diff --git a/core/src/main/java/net/infumia/frame/pipeline/PipelineImpl.java b/core/src/main/java/net/infumia/frame/pipeline/PipelineImpl.java index aef1198..e0e724e 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/PipelineImpl.java +++ b/core/src/main/java/net/infumia/frame/pipeline/PipelineImpl.java @@ -11,11 +11,15 @@ public class PipelineImpl implements Pipeline repository; + private PipelineImpl(@NotNull final ServiceRepository repository) { + this.repository = repository; + } + public PipelineImpl( @NotNull final TypeToken> type, @NotNull final PipelineService defaultService ) { - this.repository = ServicePipelineBuilder.newBuilder().build().create(type, defaultService); + this(ServicePipelineBuilder.newBuilder().build().create(type, defaultService)); } @NotNull @@ -36,4 +40,10 @@ public CompletableFuture completeWith(@NotNull final B context) { public CompletableFuture completeWithAsync(@NotNull final B context) { return this.repository.completeWithAsync(context); } + + @NotNull + @Override + public Pipeline cloned() { + return new PipelineImpl<>(this.repository.cloned()); + } } diff --git a/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorElementImpl.java b/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorElementImpl.java index d76f842..e12d229 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorElementImpl.java +++ b/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorElementImpl.java @@ -17,7 +17,7 @@ public final class PipelineExecutorElementImpl implements PipelineExecutorElement { - private final PipelineHolderElement pipelines = PipelineHolderElement.BASE.createNew(); + private final PipelineHolderElement pipelines = PipelineHolderElement.BASE.cloned(); private final ElementRich element; public PipelineExecutorElementImpl(@NotNull final ElementRich element) { diff --git a/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorFrameImpl.java b/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorFrameImpl.java index df0b0a2..503d661 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorFrameImpl.java +++ b/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorFrameImpl.java @@ -16,7 +16,7 @@ public final class PipelineExecutorFrameImpl implements PipelineExecutorFrame { - private final PipelineHolderFrame pipelines = PipelineHolderFrame.BASE.createNew(); + private final PipelineHolderFrame pipelines = PipelineHolderFrame.BASE.cloned(); private final Frame frame; public PipelineExecutorFrameImpl(@NotNull final Frame frame) { diff --git a/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorRenderImpl.java b/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorRenderImpl.java index 6515d27..5c0d2da 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorRenderImpl.java +++ b/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorRenderImpl.java @@ -16,7 +16,7 @@ public final class PipelineExecutorRenderImpl implements PipelineExecutorRender { - private final PipelineHolderRender pipelines = PipelineHolderRender.BASE.createNew(); + private final PipelineHolderRender pipelines = PipelineHolderRender.BASE.cloned(); private final ContextRender context; public PipelineExecutorRenderImpl(@NotNull final ContextRender context) { diff --git a/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorStateImpl.java b/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorStateImpl.java index d311b00..470e5dd 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorStateImpl.java +++ b/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorStateImpl.java @@ -14,7 +14,7 @@ public final class PipelineExecutorStateImpl implements PipelineExecutorState { - private final PipelineHolderState pipelines = PipelineHolderState.BASE.createNew(); + private final PipelineHolderState pipelines = PipelineHolderState.BASE.cloned(); private final ContextBase context; public PipelineExecutorStateImpl(@NotNull final ContextBase context) { diff --git a/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorViewImpl.java b/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorViewImpl.java index 6c719fc..dcf07ee 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorViewImpl.java +++ b/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorViewImpl.java @@ -28,7 +28,7 @@ public final class PipelineExecutorViewImpl implements PipelineExecutorView { - private final PipelineHolderView pipelines = PipelineHolderView.BASE.createNew(); + private final PipelineHolderView pipelines = PipelineHolderView.BASE.cloned(); private final View view; public PipelineExecutorViewImpl(@NotNull final View view) { diff --git a/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorViewerImpl.java b/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorViewerImpl.java index 15df822..3eecf16 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorViewerImpl.java +++ b/core/src/main/java/net/infumia/frame/pipeline/executor/PipelineExecutorViewerImpl.java @@ -13,7 +13,7 @@ public final class PipelineExecutorViewerImpl implements PipelineExecutorViewer { - private final PipelineHolderViewer pipelines = PipelineHolderViewer.BASE.createNew(); + private final PipelineHolderViewer pipelines = PipelineHolderViewer.BASE.cloned(); private final ContextRender context; public PipelineExecutorViewerImpl(@NotNull final ContextRender context) { diff --git a/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderElement.java b/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderElement.java index b35f7bd..63408a6 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderElement.java +++ b/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderElement.java @@ -16,9 +16,10 @@ import net.infumia.frame.pipeline.service.element.ServiceRenderLogging; import net.infumia.frame.pipeline.service.element.ServiceUpdate; import net.infumia.frame.pipeline.service.element.ServiceUpdateLogging; +import net.infumia.frame.util.Cloned; import org.jetbrains.annotations.NotNull; -public final class PipelineHolderElement { +public final class PipelineHolderElement implements Cloned { private final PipelineConsumer render; private final PipelineConsumer clear; @@ -69,8 +70,14 @@ public PipelineConsumer update() { } @NotNull - public PipelineHolderElement createNew() { - return new PipelineHolderElement(this.render, this.clear, this.click, this.update); + @Override + public PipelineHolderElement cloned() { + return new PipelineHolderElement( + this.render.cloned(), + this.clear.cloned(), + this.click.cloned(), + this.update.cloned() + ); } public PipelineHolderElement( diff --git a/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderFrame.java b/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderFrame.java index e88f607..db6c441 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderFrame.java +++ b/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderFrame.java @@ -14,10 +14,11 @@ import net.infumia.frame.pipeline.service.frame.ServiceViewCreated; import net.infumia.frame.pipeline.service.frame.ServiceViewRegistered; import net.infumia.frame.pipeline.service.frame.ServiceViewUnregisteredLogging; +import net.infumia.frame.util.Cloned; import net.infumia.frame.view.View; import org.jetbrains.annotations.NotNull; -public final class PipelineHolderFrame { +public final class PipelineHolderFrame implements Cloned { private final Pipeline> viewCreated; private final Pipeline> viewRegistered; @@ -68,12 +69,13 @@ public PipelineConsumer viewUnregistered( } @NotNull - public PipelineHolderFrame createNew() { + @Override + public PipelineHolderFrame cloned() { return new PipelineHolderFrame( - this.viewCreated, - this.viewRegistered, - this.listenersRegistered, - this.viewUnregistered + this.viewCreated.cloned(), + this.viewRegistered.cloned(), + this.listenersRegistered.cloned(), + this.viewUnregistered.cloned() ); } diff --git a/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderRender.java b/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderRender.java index b2835e9..40ca33b 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderRender.java +++ b/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderRender.java @@ -29,9 +29,10 @@ import net.infumia.frame.pipeline.service.render.ServiceUpdateOnUpdate; import net.infumia.frame.pipeline.service.view.ServiceTransition; import net.infumia.frame.pipeline.service.view.ServiceTransitionLogging; +import net.infumia.frame.util.Cloned; import org.jetbrains.annotations.NotNull; -public final class PipelineHolderRender { +public final class PipelineHolderRender implements Cloned { private final PipelineConsumer firstRender; private final PipelineConsumer transition; @@ -119,15 +120,16 @@ public PipelineConsumer update() { } @NotNull - public PipelineHolderRender createNew() { + @Override + public PipelineHolderRender cloned() { return new PipelineHolderRender( - this.firstRender, - this.transition, - this.openContainer, - this.resume, - this.startUpdate, - this.stopUpdate, - this.update + this.firstRender.cloned(), + this.transition.cloned(), + this.openContainer.cloned(), + this.resume.cloned(), + this.startUpdate.cloned(), + this.stopUpdate.cloned(), + this.update.cloned() ); } diff --git a/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderState.java b/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderState.java index f7321bc..ef03e67 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderState.java +++ b/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderState.java @@ -7,9 +7,10 @@ import net.infumia.frame.pipeline.context.PipelineContextState; import net.infumia.frame.pipeline.service.state.ServiceAccessLogging; import net.infumia.frame.pipeline.service.state.ServiceUpdateLogging; +import net.infumia.frame.util.Cloned; import org.jetbrains.annotations.NotNull; -public final class PipelineHolderState { +public final class PipelineHolderState implements Cloned { private final PipelineConsumer access; private final PipelineConsumer update; @@ -36,8 +37,9 @@ public PipelineConsumer update() { } @NotNull - public PipelineHolderState createNew() { - return new PipelineHolderState(this.access, this.update); + @Override + public PipelineHolderState cloned() { + return new PipelineHolderState(this.access.cloned(), this.update.cloned()); } public PipelineHolderState( diff --git a/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderView.java b/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderView.java index fd9b1e5..1facd4a 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderView.java +++ b/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderView.java @@ -38,11 +38,12 @@ import net.infumia.frame.pipeline.service.view.ServiceProcessConfigModifier; import net.infumia.frame.pipeline.service.view.ServiceProcessConfigModifierAddSizeModifier; import net.infumia.frame.pipeline.service.view.ServiceProcessConfigModifierLogging; +import net.infumia.frame.util.Cloned; import net.infumia.frame.view.ViewContainer; import net.infumia.frame.viewer.Viewer; import org.jetbrains.annotations.NotNull; -public final class PipelineHolderView { +public final class PipelineHolderView implements Cloned { private final PipelineConsumer init; private final Pipeline> createViewers; @@ -178,19 +179,20 @@ public PipelineConsumer close() { } @NotNull - public PipelineHolderView createNew() { + @Override + public PipelineHolderView cloned() { return new PipelineHolderView( - this.init, - this.createViewers, - this.createContext, - this.open, - this.processConfigModifiers, - this.createContainer, - this.modifyContainer, - this.layoutResolution, - this.createRender, - this.click, - this.close + this.init.cloned(), + this.createViewers.cloned(), + this.createContext.cloned(), + this.open.cloned(), + this.processConfigModifiers.cloned(), + this.createContainer.cloned(), + this.modifyContainer.cloned(), + this.layoutResolution.cloned(), + this.createRender.cloned(), + this.click.cloned(), + this.close.cloned() ); } diff --git a/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderViewer.java b/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderViewer.java index 175e3f8..1d6e71e 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderViewer.java +++ b/core/src/main/java/net/infumia/frame/pipeline/holder/PipelineHolderViewer.java @@ -14,9 +14,10 @@ import net.infumia.frame.pipeline.service.viewer.ServiceRemovedLogging; import net.infumia.frame.pipeline.service.viewer.ServiceRemovedOnViewerRemoved; import net.infumia.frame.pipeline.service.viewer.ServiceRemovedStopUpdateTask; +import net.infumia.frame.util.Cloned; import org.jetbrains.annotations.NotNull; -public final class PipelineHolderViewer { +public final class PipelineHolderViewer implements Cloned { private final PipelineConsumer added; private final PipelineConsumer removed; @@ -50,8 +51,9 @@ public PipelineConsumer removed() { } @NotNull - public PipelineHolderViewer createNew() { - return new PipelineHolderViewer(this.added, this.removed); + @Override + public PipelineHolderViewer cloned() { + return new PipelineHolderViewer(this.added.cloned(), this.removed.cloned()); } public PipelineHolderViewer( diff --git a/core/src/main/java/net/infumia/frame/pipeline/service/element/ServiceClear.java b/core/src/main/java/net/infumia/frame/pipeline/service/element/ServiceClear.java index 474db64..ace7b3a 100644 --- a/core/src/main/java/net/infumia/frame/pipeline/service/element/ServiceClear.java +++ b/core/src/main/java/net/infumia/frame/pipeline/service/element/ServiceClear.java @@ -14,6 +14,7 @@ public final class ServiceClear implements PipelineServiceConsumer StateValue updateStateValue( ) { final StateValue stateValue = this.accessStateValue(state); if (stateValue == null) { - this.context.frame().logger().debug("State '%s' is not registered!", state); return null; } final T oldValue = stateValue.value(); @@ -83,7 +82,6 @@ public StateValue updateStateValue( public StateValue updateStateValue(@NotNull final StateRich state) { final StateValue stateValue = this.accessStateValue(state); if (stateValue == null) { - this.context.frame().logger().debug("State '%s' is not registered!", state); return null; } this.pipelines.executeUpdate(state, stateValue.value(), stateValue); @@ -124,7 +122,6 @@ public CompletableFuture> accessStateValueOrInitializeWait( ) { return this.accessStateValueWait(state).thenCompose(stateValue -> { if (stateValue == null) { - this.context.frame().logger().debug("State '%s' is not registered!", state); return CompletableFuture.completedFuture(null); } final T oldValue = stateValue.value(); @@ -142,7 +139,6 @@ public CompletableFuture> accessStateValueOrInitializeWait( ) { return this.accessStateValueWait(state).thenCompose(stateValue -> { if (stateValue == null) { - this.context.frame().logger().debug("State '%s' is not registered!", state); return CompletableFuture.completedFuture(null); } return this.pipelines.executeUpdate( @@ -161,6 +157,7 @@ public void watchStateAccess( this.pipelines.applyAccess( Implementation.register( new PipelineServiceConsumer() { + @NotNull @Override public String key() { return ""; @@ -186,6 +183,7 @@ public void watchStateUpdate( this.pipelines.applyUpdate( Implementation.register( new PipelineServiceConsumer() { + @NotNull @Override public String key() { return "";