Package dev.enola.data
Class RepositoryBuilder<T>
java.lang.Object
dev.enola.data.RepositoryBuilder<T>
- All Implemented Interfaces:
Builder<Repository<T>>,Provider<String,,T> ProviderFromIRI<T>,Repository<T>,RepositoryRW<T>,Store<T>
- Direct Known Subclasses:
DatatypeRepositoryBuilder,NamespaceRepositoryBuilder,ThingMemoryRepositoryROBuilder
public abstract class RepositoryBuilder<T>
extends Object
implements RepositoryRW<T>, Builder<Repository<T>>
RepositoryBuilder builds immutable
Repository instances.
This Builder class itself is NOT thread-safe. The Repository returned by its build() however is thread-safe (simply because it's immutable). Use MemoryRepositoryRW
for a thread-safe Store.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedRepositoryBuilder(ImmutableList<Trigger<? extends T>> triggers) -
Method Summary
Modifier and TypeMethodDescriptionbuild()protected ImmutableSortedMap<String, T> buildMap()Get.protected abstract Stringlist()list() returns Ts directly (not just the IRIs, likeRepository.listIRI()).listIRI()map()protected <O> OStore a T.Store multiple Ts; seeStore.store(Object).protected voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.enola.data.ProviderFromIRI
getMethods inherited from interface dev.enola.data.Repository
list, listIRI, stream
-
Constructor Details
-
RepositoryBuilder
-
RepositoryBuilder
protected RepositoryBuilder()
-
-
Method Details
-
map
-
store
Description copied from interface:StoreStore a T.If this store already has this T, then it's replaced (entirely, not "merged").
-
storeAll
Description copied from interface:StoreStore multiple Ts; seeStore.store(Object). -
build
-
buildMap
-
require
-
getIRI
-
list
Description copied from interface:Repositorylist() returns Ts directly (not just the IRIs, likeRepository.listIRI()).This default implementation here just combines
Repository.listIRI()andProviderFromIRI.get(String). Your subclass may be able to provide a more efficient and more "direct" implementation?- Specified by:
listin interfaceRepository<T>
-
listIRI
- Specified by:
listIRIin interfaceRepository<T>
-
get
Description copied from interface:ProviderGet.- Specified by:
getin interfaceProvider<String,T> - Specified by:
getin interfaceProviderFromIRI<T>- Parameters:
iri- Key, never null- Returns:
- value, or null if there is no Value for the given key
-
trigger
-