public interface RepositoryFragment<T>
RepositoryComposition
. Fragments can be purely structural or backed with an implementation.
Structural
fragments are not backed by an implementation and are primarily used to
discover the structure of a repository composition and to perform validations.
Implemented
repository fragments consist of a signature contributor and the implementing
object. A signature contributor may be an interface
or
just the implementing object
providing the available signatures for a repository.
Fragments are immutable.RepositoryComposition
Modifier and Type | Interface and Description |
---|---|
static class |
RepositoryFragment.ImplementedRepositoryFragment<T> |
static class |
RepositoryFragment.StructuralRepositoryFragment<T> |
Modifier and Type | Method and Description |
---|---|
default Optional<T> |
getImplementation() |
Class<?> |
getSignatureContributor() |
default boolean |
hasMethod(Method method)
Attempt to find the
Method by name and exact parameters. |
static <T> RepositoryFragment<T> |
implemented(Class<T> interfaceClass,
T implementation)
|
static <T> RepositoryFragment<T> |
implemented(T implementation)
Create an implemented
RepositoryFragment backed by the implementation object. |
default Stream<Method> |
methods() |
static <T> RepositoryFragment<T> |
structural(Class<T> interfaceOrImplementation)
Create a structural
RepositoryFragment given interfaceOrImplementation . |
RepositoryFragment<T> |
withImplementation(T implementation)
Implement a structural
RepositoryFragment given its implementation object. |
static <T> RepositoryFragment<T> implemented(T implementation)
RepositoryFragment
backed by the implementation
object.implementation
- must not be null.static <T> RepositoryFragment<T> implemented(Class<T> interfaceClass, T implementation)
implementation
- must not be null.static <T> RepositoryFragment<T> structural(Class<T> interfaceOrImplementation)
RepositoryFragment
given interfaceOrImplementation
.interfaceOrImplementation
- must not be null.default boolean hasMethod(Method method)
Method
by name and exact parameters. Returns true if the method was found or
false otherwise.method
- must not be null.default Optional<T> getImplementation()
Optional.empty()
.default Stream<Method> methods()
Stream
of methods exposed by this RepositoryFragment
.Class<?> getSignatureContributor()
RepositoryFragment
.RepositoryFragment<T> withImplementation(T implementation)
RepositoryFragment
given its implementation
object. Returns an implemented
RepositoryFragment
.implementation
- must not be null.RepositoryFragment
for implementation
.Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.