AI - abstract input symbol type.AO - abstract output symbol type.CI - concrete input symbol type.CO - concrete output symbol type.public interface SULMapper<AI,AO,CI,CO> extends Mapper.SynchronousMapper<AI,AO,CI,CO>
Mapper interface specifically for SULs.
The class SULMappers provides static utility functions for manipulating mappers.
SULMappers, like SULs, may be forkable. The requirements and semantics of fork()
are basically the same as set forth for SUL.fork(). Stateless mappers (e.g., with empty Mapper.pre() and
Mapper.post() implementations), should always be forkable, and fork() may just return this.
Stateful mappers may require more sophisticated fork logic, but in general it should be possible to fork them as
well.
Note: despite the above recommendation that mappers should almost always be forkable, the default implementations of
canFork() and fork() indicate non-forkability for backwards compatibility reasons.
| Modifier and Type | Interface and Description |
|---|---|
static class |
SULMapper.MappedException<AO> |
| Modifier and Type | Method and Description |
|---|---|
default boolean |
canFork()
Checks whether it is possible to
fork this mapper. |
default SULMapper<AI,AO,CI,CO> |
fork()
Forks this mapper, i.e., returns a mapper that behaves in exactly the same way as this mapper, but allows for
being used independently of this mapper.
|
default SULMapper.MappedException<? extends AO> |
mapUnwrappedException(RuntimeException exception)
Maps an unwrapped
RuntimeException to an abstract output symbol, or rethrows it if it is unmappable. |
default SULMapper.MappedException<? extends AO> |
mapWrappedException(SULException exception)
Maps a wrapped
SULException to an abstract output symbol, or rethrows it if it is unmappable. |
default boolean canFork()
fork this mapper.true if this mapper can be forked, false otherwise.@Nonnull default SULMapper<AI,AO,CI,CO> fork() throws UnsupportedOperationException
If canFork() returned false, this method must throw an UnsupportedOperationException.
Otherwise, it must return a non-null object representing the fork of this mapper.
this should be returned)UnsupportedOperationException - if this mapper is not forkabledefault SULMapper.MappedException<? extends AO> mapWrappedException(SULException exception) throws SULException
SULException to an abstract output symbol, or rethrows it if it is unmappable.exception - the wrapped exception that was thrownSULException - if the exception cannot be mapped, or if a new exception occurs while trying to map the given exceptiondefault SULMapper.MappedException<? extends AO> mapUnwrappedException(RuntimeException exception)
RuntimeException to an abstract output symbol, or rethrows it if it is unmappable.exception - the runtime exception that was thrownSULException - if a new exception occurs while trying to map the given exceptionRuntimeException - if the given exception cannot be mapped, or if a new exception occurs while trying to map the given
exceptionCopyright © 2019. All rights reserved.