|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.amazon.carbonado.synthetic.SyntheticStorableReferenceBuilder<S>
public class SyntheticStorableReferenceBuilder<S extends Storable>
A SyntheticStorableReference defines new kinds of Storables from an existing master storable. This is used in situations when additional information about a storable needs to be tracked -- eg, for an index, or for caching. The storable may optionally have completely new, synthetic properties added.
All primary key properties of the master storable will also be provided by the derived storable. Three special methods will be provided:
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.amazon.carbonado.synthetic.SyntheticBuilder |
|---|
SyntheticBuilder.ClassNameProvider |
| Constructor Summary | |
|---|---|
SyntheticStorableReferenceBuilder(Class<S> storableClass,
boolean isUnique)
|
|
SyntheticStorableReferenceBuilder(Class<S> storableClass,
String baseName,
boolean isUnique)
|
|
| Method Summary | |
|---|---|
SyntheticKey |
addAlternateKey()
Add an alternate key to be built. |
SyntheticIndex |
addIndex()
Add an index to the set managed by this builder. |
SyntheticProperty |
addKeyProperty(String name,
Direction direction)
Add a property to the primary key which is a member of the Storable type being referenced by this one. |
SyntheticKey |
addPrimaryKey()
Add a primary key to be built. |
SyntheticProperty |
addProperty(String name,
Class type)
Add a property to the set managed by this builder. |
SyntheticProperty |
addProperty(SyntheticProperty prop)
Add an externally defined synthetic property to the list |
Class<? extends Storable> |
build()
Convenience method to generate the class. |
void |
copyFromMaster(Storable indexEntry,
S master)
Deprecated. call getReferenceAccess |
void |
copyToMasterPrimaryKey(Storable indexEntry,
S master)
Deprecated. call getReferenceAccess |
Comparator<? extends Storable> |
getComparator()
Deprecated. call getReferenceAccess |
Object |
getName()
|
SyntheticStorableReferenceAccess |
getReferenceAccess()
Build and return access to the generated storable reference class. |
Class<? extends Storable> |
getStorableClass()
|
List<SyntheticProperty> |
getUserProps()
|
boolean |
hasProperty(String name)
Check to see if a particular property has already been added to the list of properties to generate |
boolean |
isConsistent(Storable indexEntry,
S master)
Deprecated. call getReferenceAccess |
boolean |
isUnique()
True if the generated derived class should be considered unique. |
boolean |
isVersioned()
Returns true if a property with the version attribute has been addded |
ClassFileBuilder |
prepare()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SyntheticStorableReferenceBuilder(Class<S> storableClass,
boolean isUnique)
storableClass - class of the storable that will be referenced by this
synthetic. The name for the synthetic storable will be based
on this class's name, decorated with the properties which
participate in the primary key for the synthetic storable.
public SyntheticStorableReferenceBuilder(Class<S> storableClass,
String baseName,
boolean isUnique)
storableClass - class of the storable that will be referenced by this
syntheticbaseName - of the generated synthetic. Note that for some repositories
this name will be visible across the entire repository, so it
is good practice to include namespace information to guarantee
uniqueness.isUnique - true if the properties that are explicitly identified as primary
key properites are sufficient to uniquely identify the index object.| Method Detail |
|---|
public ClassFileBuilder prepare()
throws SupportException
prepare in interface SyntheticBuilderClassFileBuilder ready for further decoration or building
SupportExceptionpublic SyntheticStorableReferenceAccess getReferenceAccess()
public Class<? extends Storable> getStorableClass()
throws IllegalStateException
getStorableClass in interface SyntheticBuilderSyntheticBuilder.prepare() already have been called
prior to calling this method.
IllegalStateException - if build has not yet been called.
public Class<? extends Storable> build()
throws SupportException
SyntheticBuilderSyntheticBuilder.prepare() and return the result of
generating the class from that classfile. If the caller does not
wish to regenerate the class from scratch, use SyntheticBuilder.getStorableClass() instead.
build in interface SyntheticBuilderSupportException
public SyntheticProperty addKeyProperty(String name,
Direction direction)
name -
public SyntheticProperty addProperty(String name,
Class type)
SyntheticBuilder
addProperty in interface SyntheticBuildername - of the propertytype - of the property
SyntheticStorableBuilder.addProperty(java.lang.String,
java.lang.Class)public SyntheticProperty addProperty(SyntheticProperty prop)
SyntheticBuilder
addProperty in interface SyntheticBuilderprop - to add
SyntheticStorableBuilder.addProperty(com.amazon.carbonado.synthetic.SyntheticProperty)public boolean hasProperty(String name)
SyntheticBuilder
hasProperty in interface SyntheticBuilderpublic List<SyntheticProperty> getUserProps()
public SyntheticKey addPrimaryKey()
SyntheticBuilder
addPrimaryKey in interface SyntheticBuilderpublic SyntheticKey addAlternateKey()
SyntheticBuilder
addAlternateKey in interface SyntheticBuilderpublic SyntheticIndex addIndex()
SyntheticBuilder
addIndex in interface SyntheticBuilderpublic Object getName()
public boolean isUnique()
public boolean isVersioned()
SyntheticBuilder
isVersioned in interface SyntheticBuilder
@Deprecated
public void copyToMasterPrimaryKey(Storable indexEntry,
S master)
throws FetchException
indexEntry - source of property valuesmaster - master whose primary key properties will be set
FetchException
@Deprecated
public void copyFromMaster(Storable indexEntry,
S master)
throws FetchException
indexEntry - index entry whose properties will be setmaster - source of property values
FetchException
@Deprecated
public boolean isConsistent(Storable indexEntry,
S master)
throws FetchException
indexEntry - index entry whose properties will be testedmaster - source of property values
FetchException@Deprecated public Comparator<? extends Storable> getComparator()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||