Class AbstractProvider
java.lang.Object
org.jdrupes.builder.core.AbstractProvider
- All Implemented Interfaces:
ResourceProvider
- Direct Known Subclasses:
AbstractGenerator, AbstractProject, JavaExecutor, MvnRepoLookup
A base implementation for
ResourceProviders.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncontext()Convenience method to access the build context which is sometimes needed in the context of resource requests.doProvide(ResourceRequest<T> requested) Invoked byResourceProviderSpi.provide(ResourceRequest)after checking if the invocation is allowed.name()Returns the name of this resource provider.protected <T extends Resource>
TnewResource(ResourceType<T> type, Object... args) Convenience function to create a new resource.<T extends Resource>
ResourceRequest<T> of(ResourceType<? extends T> type) Create a new request for the given resource.protected final AbstractProviderAllows derived classes to change the provider's name in their implementation ofRenamable.name(String).toString()<T extends Resource>
io.vavr.collection.Stream<T> vavrStream(Resources<T> resources) Retrieves the resources as a Vavr stream.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ResourceProvider
of, resources
-
Constructor Details
-
AbstractProvider
public AbstractProvider()Initializes a new abstract provider.
-
-
Method Details
-
name
Description copied from interface:ResourceProviderReturns the name of this resource provider.- Specified by:
namein interfaceResourceProvider- Returns:
- the string
-
rename
Allows derived classes to change the provider's name in their implementation ofRenamable.name(String). Throws anUnsupportedOperationExceptionif the derived class does not implementRenamable.- Parameters:
name- the name- Returns:
- the abstract provider
-
doProvide
Invoked byResourceProviderSpi.provide(ResourceRequest)after checking if the invocation is allowed.- Type Parameters:
T- the generic type- Parameters:
requested- the requested- Returns:
- the stream
-
of
Description copied from interface:ResourceProviderCreate a new request for the given resource.- Specified by:
ofin interfaceResourceProvider- Type Parameters:
T- the resource type- Parameters:
type- the type- Returns:
- the resource request
-
context
Description copied from interface:ResourceProviderConvenience method to access the build context which is sometimes needed in the context of resource requests.- Specified by:
contextin interfaceResourceProvider- Returns:
- the builder configuration
-
newResource
Convenience function to create a new resource. Short for invokingResourceFactory.create(ResourceType, Project, Object...)with the requested resource type,nullfor the project and the remaining given arguments appended.- Type Parameters:
T- the resource type- Parameters:
type- the typeargs- the arguments- Returns:
- the resource
-
vavrStream
Retrieves the resources as a Vavr stream.- Type Parameters:
T- the resource type- Parameters:
resources- the resources- Returns:
- the stream
-
toString
-