@AutoService(value=io.virtdata.api.DataMapperLibrary.class) public class ComposerLibrary extends Object implements DataMapperLibrary
This library implements the ability to compose a lambda function from a sequence of other functions. The resulting lambda will use the specialized primitive function interfaces, such as LongUnaryOperator, LongFunction, etc. Where there are two functions which do not have matching input and output types, the most obvious conversion is made. This means that while you are able to compose a LongUnaryOperator with a LongUnaryOperator for maximum efficiency, you can also compose LongUnaryOperator with an IntFunction, and a best effort attempt will be made to do a reasonable conversion in between.
Due to type erasure, it is not possible to know the generic type parameters for non-primitive functional types. These include IntFunction<?>, LongFunction<?>, and in the worst case, Function<?,?>. For these types, annotations are provided to better inform the runtime lambda compositor.
The library allows for there to be multiple functions which match the spec, possibly because multiple functions have the same name, but exist in different libraries or in different packages within the same library. This means that the composer library must find a connecting path between the functions that can match at each stage, disregarding all but one.
The rule for finding the best path among the available functions is as follows, at each pairing between adjacent stages of functions:
ValueType| Constructor and Description |
|---|
ComposerLibrary() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canParseSpec(String spec) |
List<String> |
getDataMapperNames() |
String |
getLibraryName() |
Optional<ResolvedFunction> |
resolveFunction(String specline) |
List<ResolvedFunction> |
resolveFunctions(String spec) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDataMapperpublic String getLibraryName()
getLibraryName in interface DataMapperLibrarypublic boolean canParseSpec(String spec)
canParseSpec in interface DataMapperLibrarypublic List<ResolvedFunction> resolveFunctions(String spec)
resolveFunctions in interface DataMapperLibrarypublic Optional<ResolvedFunction> resolveFunction(String specline)
resolveFunction in interface DataMapperLibrarypublic List<String> getDataMapperNames()
getDataMapperNames in interface DataMapperLibraryCopyright © 2017. All rights reserved.