Package eu.bandm.tools.ramus.ogma
Interface Data.View<A>
- Type Parameters:
A- the type of unwrapped values
- All Known Implementing Classes:
Data.ViewProxy
- Enclosing interface:
Data
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface for unwrapping interpretation of semantic data.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <B,C> Data.View <C> andThenCombining(Data.View<B> other, BiFunction<? super A, ? super B, ? extends C> pair) Returns a view that expects a pair, interprets the two elements according to this and a given other view, respectively, and combines the results with a given function.static <A> Data.View<A> Returns a view that expects atomic data of the given type.static <A> Data.View<A> Returns a view that expects atomic data of the given type.default <B> Data.View<B> Returns a view that transforms data interpreted by this view with a given function.Returns a view that expects a pair, interprets the two elements according to this and a given other view, respectively, and combines the results as a map entry.optional()Returns a view that expects an optional data element, to be interpreted by this view if present.Returns a view that expects an optional data element, to be interpreted by this view, or as the given default value if absent.Returns a view that expects an optional data element, to be interpreted by this view, or as the given default value if absent.sequence()Returns a view that expects a sequence of data elements, each to be interpreted by this view.token()Returns a view that expects a token.Returns the unwrapped interpretation of the given data according to this view.
-
Method Details
-
view
Returns the unwrapped interpretation of the given data according to this view.- Parameters:
data- the wrapped data- Returns:
- the unwrapped data, if this view is compatible
- Throws:
ClassCastException- if this view is incompatible
-
atomic
Returns a view that expects atomic data of the given type.The returned view checks that its results are instances of
cls.- Type Parameters:
A- the type of unwrapped values- Parameters:
cls- the type of unwrapped values- Returns:
- a view that expects atomic data of type
cls
-
atomicUnchecked
Returns a view that expects atomic data of the given type.The returned view does not check that its results are instances of
A;ClassCastExceptionmay ensue later.- Type Parameters:
A- the type of unwrapped values- Returns:
- a view that expects atomic data of type
A
-
token
Returns a view that expects a token.- Type Parameters:
D- the type of document identifiersT- the type of token types- Returns:
- a view that expects a token
-
sequence
Returns a view that expects a sequence of data elements, each to be interpreted by this view.- Returns:
- a view that expects a sequence of data elements, each to be
interpreted by
this
-
orElse
Returns a view that expects an optional data element, to be interpreted by this view, or as the given default value if absent.- Parameters:
defaultValue- the defaultValue- Returns:
- a view that expects an optional data element, to be interpreted
by
thisor asdefaultValueif absent
-
orElseGet
Returns a view that expects an optional data element, to be interpreted by this view, or as the given default value if absent.The default value is provided by a supplier, and only requested if required.
- Parameters:
defaultValue- a supplier for the defaultValue- Returns:
- a view that expects an optional data element, to be interpreted
by
thisor asdefaultValue.get()if absent
-
optional
Returns a view that expects an optional data element, to be interpreted by this view if present.- Returns:
- a view that expects an optional data element, to be interpreted
by
thisor asOptional.empty()if absent
-
map
Returns a view that transforms data interpreted by this view with a given function.- Type Parameters:
B- the type of transformed values- Parameters:
fun- the transformation function- Returns:
- a view that transforms data interpreted
thiswithfun - Throws:
NullPointerException- iffunis null
-
andThenCombining
default <B,C> Data.View<C> andThenCombining(Data.View<B> other, BiFunction<? super A, ? super B, ? extends C> pair) Returns a view that expects a pair, interprets the two elements according to this and a given other view, respectively, and combines the results with a given function.- Type Parameters:
B- the type of unwrapped values of the second element of the pairC- the type of combined values- Parameters:
other- the view for the second element of the pairpair- the combining function- Returns:
- a view that expects a pair, interprets the two elements according
to
thisandotherview, respectively, and combines the results withpair - Throws:
NullPointerException- ifotherorpairis null
-
mapsTo
Returns a view that expects a pair, interprets the two elements according to this and a given other view, respectively, and combines the results as a map entry.The resulting map entry is immutable.
- Type Parameters:
B- the type of unwrapped values of the second element of the pair- Parameters:
other- the view for the second element of the pair- Returns:
- a view that expects a pair, interprets the two elements according
to
thisandotherview, results, and combines the results as a map entry - Throws:
NullPointerException- ifotheris null
-