org.schemarepo
Class ReadOnlyRepository
java.lang.Object
org.schemarepo.BaseRepository
org.schemarepo.DelegatingRepository
org.schemarepo.ReadOnlyRepository
- All Implemented Interfaces:
- Closeable, Repository
public class ReadOnlyRepository
- extends DelegatingRepository
ReadOnlyRepository is a Repository implementation that wraps another
Repository and rejects all operations that can modify the state of
the Repository.
register(String, SubjectConfig), Subject.register(String)
and Subject.registerIfLatest(String, SchemaEntry) throw
IllegalStateException if called.
ReadOnlyRepository
@Inject
public ReadOnlyRepository(Repository repo)
- Create a repository that disallows mutations to the underlying repository.
- Parameters:
repo - The repository to wrap
register
public Subject register(String subjectName,
SubjectConfig config)
- Description copied from interface:
Repository
- Attempt to create a Subject with the given name and validator.
- Specified by:
register in interface Repository- Overrides:
register in class DelegatingRepository
- Parameters:
subjectName - The name of the subject. Must not be null.config - The subject configuration. May be null.
- Returns:
- The newly created Subject, or an equivalent one if already created.
Does not return null.
lookup
public Subject lookup(String subjectName)
- Description copied from interface:
Repository
- Returns the subject if it exists, null otherwise.
- Specified by:
lookup in interface Repository- Overrides:
lookup in class DelegatingRepository
- Parameters:
subjectName - the subject name
- Returns:
- The subject if it exists, null otherwise.
subjects
public Iterable<Subject> subjects()
- Description copied from interface:
Repository
- List all subjects. Does not return null.
- Specified by:
subjects in interface Repository- Overrides:
subjects in class DelegatingRepository
Copyright © 2015. All rights reserved.