io.vlingo.symbio.EntryAdapter Java Examples

The following examples show how to use io.vlingo.symbio.EntryAdapter. 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 vote down vote up
/**
 * 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 vote down vote up
@SuppressWarnings("unchecked")
private static <S extends Source<?>, E extends Entry<?>> EntryAdapter<S, E> defaultTextEntryAdapter() {
  return new DefaultTextEntryAdapter();
}
 
Example #3
Source File: StateStoreProjectionActor.java    From vlingo-lattice with Mozilla Public License 2.0 2 votes vote down vote up
/**
 * Answer the {@code EntryAdapter<S,E>} previously registered by construction.
 * @param <S> the {@code Source<?>} type
 * @param <E> the {@code Entry<?>} type
 * @return {@code EntryAdapter<S,E>}
 */
@SuppressWarnings("unchecked")
protected <S extends Source<?>, E extends Entry<?>> EntryAdapter<S,E> entryAdapter() {
  return (EntryAdapter<S,E>) this.entryAdapter;
}
 
Example #4
Source File: SourcedTypeRegistry.java    From vlingo-lattice with Mozilla Public License 2.0 2 votes vote down vote up
/**
 * Answer myself after registering the {@code adapter}.
 * @param sourceType the {@code Class<S>} of the EntryAdapter to register
 * @param adapter the {@code EntryAdapter<S,E>} to registered
 * @param <S> the {@code Source<?>} extender being registered
 * @param <E> the {@code Entry<?>} extender being registered
 * @return {@code Info<T>}
 */
public <S extends Source<?>,E extends Entry<?>> Info<T> registerEntryAdapter(final Class<S> sourceType, final EntryAdapter<S,E> adapter) {
  entryAdapterProvider.registerAdapter(sourceType, adapter);
  return this;
}
 
Example #5
Source File: SourcedTypeRegistry.java    From vlingo-lattice with Mozilla Public License 2.0 2 votes vote down vote up
/**
 * Answer myself after registering the {@code adapter} and {@code consumer}.
 * @param sourceType the {@code Class<S>} of the EntryAdapter to register
 * @param adapter the {@code EntryAdapter<S,E>} to registered
 * @param consumer the {@code BiConsumer<Class<S>,EntryAdapter<S,E>>} being registered
 * @param <S> the {@code Source<?>} extender being registered
 * @param <E> the {@code Entry<?>} extender being registered
 * @return {@code Info<T>}
 */
public <S extends Source<?>,E extends Entry<?>> Info<T> registerEntryAdapter(final Class<S> sourceType, final EntryAdapter<S,E> adapter, final BiConsumer<Class<S>,EntryAdapter<S,E>> consumer) {
  entryAdapterProvider.registerAdapter(sourceType, adapter, consumer);
  return this;
}