io.vlingo.symbio.StateAdapter Java Examples
The following examples show how to use
io.vlingo.symbio.StateAdapter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StateStoreProjectionActor.java From vlingo-lattice with Mozilla Public License 2.0 | 5 votes |
/** * Construct my final state with the {@code StateStore}, which must * be provided by my concrete extenders, as well as with a * {@code stateAdapter} and a {@code entryAdapter}. * @param stateStore the StateStore from which previous state is read and merged current state is written * @param stateAdapter the {@code StateAdapter<Object, State<?>>} used by my extenders to adapt persistent state * @param entryAdapter the {@code EntryAdapter<Source<?>, Entry<?>>} used by my extenders to adapt persistent entries */ public StateStoreProjectionActor( final StateStore stateStore, final StateAdapter<Object, State<?>> stateAdapter, final EntryAdapter<Source<?>, Entry<?>> entryAdapter) { this.stateStore = stateStore; this.stateAdapter = stateAdapter; this.entryAdapter = entryAdapter; this.readInterest = selfAs(ReadResultInterest.class); this.writeInterest = selfAs(WriteResultInterest.class); this.adaptedSources = new ArrayList<>(2); }
Example #2
Source File: StateStoreProjectionActor.java From vlingo-lattice with Mozilla Public License 2.0 | 4 votes |
@SuppressWarnings("unchecked") private static <S, ST extends State<?>> StateAdapter<S, ST> defaultTextStateAdapter() { return (StateAdapter<S, ST>) new DefaultTextStateAdapter(); }
Example #3
Source File: StateStoreProjectionActor.java From vlingo-lattice with Mozilla Public License 2.0 | 2 votes |
/** * Answer the {@code StateAdapter<?,ST>} previously registered by construction. * @param <ST> the {@code State<?>} type * @return {@code StateAdapter<?,ST>} */ @SuppressWarnings("unchecked") protected <ST extends State<?>> StateAdapter<?,ST> stateAdapter() { return (StateAdapter<?,ST>) this.stateAdapter; }
Example #4
Source File: SourcedTypeRegistry.java From vlingo-lattice with Mozilla Public License 2.0 | 2 votes |
/** * Answer myself after registering the {@code adapter}. * @param stateType the {@code Class<S>} of the StateAdapter to register * @param adapter the {@code StateAdapter<S,ST>} to registered * @param <S> the {@code State<?>} extender being registered * @param <ST> the {@code State<?>} extender being registered * @return {@code Info<T>} */ public <S,ST extends State<?>> Info<T> registerStateAdapter(final Class<S> stateType, final StateAdapter<S,ST> adapter) { stateAdapterProvider.registerAdapter(stateType, adapter); return this; }
Example #5
Source File: SourcedTypeRegistry.java From vlingo-lattice with Mozilla Public License 2.0 | 2 votes |
/** * Answer myself after registering the {@code adapter} and {@code consumer}. * @param stateType the {@code Class<S>} of the StateAdapter to register * @param adapter the {@code StateAdapter<S,ST>} to registered * @param consumer the {@code BiConsumer<Class<S>,StateAdapter<S,ST>>} being registered * @param <S> the type of {@code State<?>} being registered * @param <ST> the {@code State<?>} extender being registered * @return {@code Info<T>} */ public <S,ST extends State<?>> Info<T> registerStateAdapter(final Class<S> stateType, final StateAdapter<S,ST> adapter, final BiConsumer<Class<S>,StateAdapter<S,ST>> consumer) { stateAdapterProvider.registerAdapter(stateType, adapter, consumer); return this; }