B
- the type of the extender of this builderP
- the type of the provider for the built serviceM
- the type of the manager for the built serviceprotected abstract static class AbstractGenericService.AbstractGenericBuilder<B extends AbstractGenericService.AbstractGenericBuilder<B,P,M>,P extends Provider,M extends Manager>
extends java.lang.Object
Builder instances can be reused, it is safe to call build()
multiple times to build multiple generic services in series.
Modifier | Constructor and Description |
---|---|
protected |
AbstractGenericBuilder()
Constructor for use by subclasses.
|
Modifier and Type | Method and Description |
---|---|
protected abstract B |
asSubtype()
Must always return
this . |
abstract Service |
build()
Returns a newly created generic service.
|
B |
manager(M manager)
Sets the manager of the built generic service.
|
B |
provider(P provider)
Sets the provider of the built generic service.
|
protected AbstractGenericBuilder()
protected abstract B asSubtype()
this
.public final B provider(P provider)
provider
- the provider, not null
Builder
objectjava.lang.NullPointerException
- if the provider is null
java.lang.IllegalStateException
- if the provider is already setpublic final B manager(M manager)
manager
- the provider, not null
Builder
objectjava.lang.NullPointerException
- if the manager is null
java.lang.IllegalStateException
- if the manager is already setpublic abstract Service build()