|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.schemarepo.api.TypedSchemaRepository<ID,SCHEMA,SUBJECT>
public class TypedSchemaRepository<ID,SCHEMA,SUBJECT>
This is a convenience class for interacting with a Schema Repository in an efficient manner. It is (lazily) cached whenever possible and strongly-typed. N.B.: Currently, there is no cache eviction mechanism, so this can potentially grow to unbounded sizes. N.B.2: registerIfLatest() is not supported in the TypedSchemaRepository, at least for now...
| Constructor Summary | |
|---|---|
TypedSchemaRepository(Repository repo,
Converter<ID> idConverter,
Converter<SCHEMA> schemaConverter,
Converter<SUBJECT> subjectConverter)
|
|
TypedSchemaRepository(Repository repo,
Converter<ID> idConverter,
Converter<SCHEMA> schemaConverter,
Converter<SUBJECT> subjectConverter,
SubjectConfig.Builder defaultSubjectConfigBuilder)
|
|
| Method Summary | |
|---|---|
SubjectConfig |
getConfig(SUBJECT subjectName)
This retrieves mutable data, hence it is not cache-able and will always result in a call to the underlying schema repo implementation. |
SCHEMA |
getLatestSchema(SUBJECT subjectName)
Gets the latest schema for a given subject. |
SCHEMA |
getSchema(SUBJECT subjectName,
ID id)
Gets a schema for a given subject and ID. |
ID |
getSchemaId(SUBJECT subjectName,
SCHEMA schema)
Gets a schema ID for a given subject and schema. |
List<SUBJECT> |
getSubjects()
This retrieves mutable data, hence it is not cache-able and will always result in a call to the underlying schema repo implementation. |
ID |
registerSchema(SUBJECT subjectName,
SCHEMA schema)
Registers a new schema in the given subject and returns its ID. |
void |
setConfig(SUBJECT subjectName,
SubjectConfig subjectConfig)
This sets mutable data, hence it will always result in a call to the underlying schema repo implementation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TypedSchemaRepository(Repository repo,
Converter<ID> idConverter,
Converter<SCHEMA> schemaConverter,
Converter<SUBJECT> subjectConverter,
SubjectConfig.Builder defaultSubjectConfigBuilder)
public TypedSchemaRepository(Repository repo,
Converter<ID> idConverter,
Converter<SCHEMA> schemaConverter,
Converter<SUBJECT> subjectConverter)
| Method Detail |
|---|
public SCHEMA getSchema(SUBJECT subjectName,
ID id)
subjectName - containing the sought schemaid - of the sought schema
public SCHEMA getLatestSchema(SUBJECT subjectName)
subjectName - to get the latest schema for
public ID getSchemaId(SUBJECT subjectName,
SCHEMA schema)
subjectName - containing the sought IDschema - corresponding to the sought ID
public ID registerSchema(SUBJECT subjectName,
SCHEMA schema)
throws SchemaValidationException
TypedSchemaRepository at construction time. If you wish to use a
non-default configuration, you should first invoke
setConfig(Object, org.schemarepo.SubjectConfig) before invoking
this function.
subjectName - to register the schema intoschema - to register
SchemaValidationExceptionpublic SubjectConfig getConfig(SUBJECT subjectName)
subjectName - to get the config for
public void setConfig(SUBJECT subjectName,
SubjectConfig subjectConfig)
subjectName - to change the config forsubjectConfig - to set for the given subjectpublic List<SUBJECT> getSubjects()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||