Interface RepositoryFragment<T>
- All Known Implementing Classes:
RepositoryFragment.ImplementedRepositoryFragment,RepositoryFragment.StructuralRepositoryFragment
public interface RepositoryFragment<T>
Value object representing a repository fragment.
Repository fragments are individual parts that contribute method signatures. They are used to form a
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.
- Since:
- 2.0
- Author:
- Mark Paluch, Christoph Strobl
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classstatic class -
Method Summary
Modifier and TypeMethodDescriptionfindMethods(String name) Find methods that match the given name.Class<?> default booleanAttempt to find theMethodby name and exact parameters.static <T> RepositoryFragment<T> implemented(Class<T> interfaceClass, T implementation) static <T> RepositoryFragment<T> implemented(T implementation) Create an implementedRepositoryFragmentbacked by theimplementationobject.methods()static <T> RepositoryFragment<T> structural(Class<T> interfaceOrImplementation) Create a structuralRepositoryFragmentgiveninterfaceOrImplementation.static <T> RepositoryFragment<T> structural(Class<T> interfaceClass, Class<?> implementationClass) withImplementation(T implementation) Implement a structuralRepositoryFragmentgiven itsimplementationobject.
-
Method Details
-
implemented
Create an implementedRepositoryFragmentbacked by theimplementationobject.- Parameters:
implementation- must not be null.- Returns:
-
implemented
- Parameters:
implementation- must not be null.- Returns:
-
structural
Create a structuralRepositoryFragmentgiveninterfaceOrImplementation.- Parameters:
interfaceOrImplementation- must not be null.- Returns:
-
structural
- Parameters:
interfaceClass- must not be null.implementationClass- must not be null.- Returns:
- Since:
- 4.0
-
hasMethod
-
getImplementation
- Returns:
- the optional implementation. Only available for implemented fragments. Structural fragments return always
Optional.empty().
-
getImplementationClass
- Returns:
- the optional implementation class. Only available for fragments that ship an implementation descriptor.
Structural (interface-only) fragments return always
Optional.empty(). - Since:
- 4.0
-
methods
- Returns:
- a
Streamof methods exposed by thisRepositoryFragment.
-
findMethods
-
getSignatureContributor
Class<?> getSignatureContributor()- Returns:
- the class/interface providing signatures for this
RepositoryFragment.
-
withImplementation
Implement a structuralRepositoryFragmentgiven itsimplementationobject. Returns an implementedRepositoryFragment.- Parameters:
implementation- must not be null.- Returns:
- a new implemented
RepositoryFragmentforimplementation.
-