public class SyntheticStorableBuilder extends java.lang.Object implements SyntheticBuilder
SyntheticBuilder.ClassNameProvider
Constructor and Description |
---|
SyntheticStorableBuilder(java.lang.String name,
java.lang.ClassLoader loader) |
Modifier and Type | Method and Description |
---|---|
SyntheticKey |
addAlternateKey()
Add an alternate key to be built.
|
SyntheticIndex |
addIndex()
Add an index to the set managed by this builder.
|
SyntheticKey |
addPrimaryKey()
Add a primary key to be built.
|
SyntheticProperty |
addProperty(java.lang.String name,
java.lang.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
|
java.lang.Class<? extends Storable> |
build()
Convenience method to generate the class.
|
protected boolean |
definePropertyBeanMethods(org.cojen.classfile.ClassFile cf,
SyntheticProperty property)
Add the get & set methods for this property
|
SyntheticBuilder.ClassNameProvider |
getClassNameProvider() |
protected java.lang.String |
getName()
Frequently used by the
SyntheticBuilder.ClassNameProvider as a
basis for the generated classname |
protected java.util.List<SyntheticProperty> |
getPropertyList()
Frequently used by the
SyntheticBuilder.ClassNameProvider as a
basis for the generated classname |
java.lang.Class<? extends Storable> |
getStorableClass() |
boolean |
hasProperty(java.lang.String name)
Check to see if a particular property has already been added to the list of
properties to generate
|
boolean |
isVersioned()
Returns true if a property with the version attribute has been addded
|
ClassFileBuilder |
prepare() |
void |
setClassNameProvider(SyntheticBuilder.ClassNameProvider classNameProvider) |
void |
setEvolvable(boolean evolvable)
By default, generated storable implements the Unevolvable marker
interface, which can affect how it is encoded.
|
java.lang.String |
toString() |
public SyntheticStorableBuilder(java.lang.String name, java.lang.ClassLoader loader)
name
- base name for the generated class. This is usually a fully qualified
name, a la "com.amazon.carbonado.storables.happy.synthetic.storable"loader
- ClassLoader
to use for the generated classpublic ClassFileBuilder prepare() throws SupportException
prepare
in interface SyntheticBuilder
ClassFileBuilder
ready for further decoration or buildingSupportException
public java.lang.Class<? extends Storable> getStorableClass()
getStorableClass
in interface SyntheticBuilder
SyntheticBuilder.prepare()
already have been called
prior to calling this method.public java.lang.Class<? extends Storable> build() throws SupportException
SyntheticBuilder
SyntheticBuilder.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 SyntheticBuilder
SupportException
public SyntheticProperty addProperty(java.lang.String name, java.lang.Class type)
SyntheticBuilder
addProperty
in interface SyntheticBuilder
name
- of the propertytype
- of the propertypublic SyntheticProperty addProperty(SyntheticProperty prop)
SyntheticBuilder
addProperty
in interface SyntheticBuilder
prop
- to addpublic boolean hasProperty(java.lang.String name)
SyntheticBuilder
hasProperty
in interface SyntheticBuilder
public SyntheticKey addPrimaryKey()
SyntheticBuilder
addPrimaryKey
in interface SyntheticBuilder
public SyntheticKey addAlternateKey()
SyntheticBuilder
addAlternateKey
in interface SyntheticBuilder
public SyntheticIndex addIndex()
SyntheticBuilder
addIndex
in interface SyntheticBuilder
public boolean isVersioned()
SyntheticBuilder
isVersioned
in interface SyntheticBuilder
public SyntheticBuilder.ClassNameProvider getClassNameProvider()
public void setClassNameProvider(SyntheticBuilder.ClassNameProvider classNameProvider)
classNameProvider
- The classNameProvider to set.public void setEvolvable(boolean evolvable)
Pass in true to change from the default behavior, and not implement Unevolvable. When doing so, a ClassNameProvider should also be provided to ensure consistent naming which does not include property names.
protected boolean definePropertyBeanMethods(org.cojen.classfile.ClassFile cf, SyntheticProperty property)
protected java.lang.String getName()
SyntheticBuilder.ClassNameProvider
as a
basis for the generated classnameprotected java.util.List<SyntheticProperty> getPropertyList()
SyntheticBuilder.ClassNameProvider
as a
basis for the generated classnamepublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2006-2013 Amazon Technologies, Inc.. All Rights Reserved.