com.amazon.carbonado.synthetic
Interface SyntheticBuilder

All Known Implementing Classes:
SyntheticStorableBuilder, SyntheticStorableReferenceBuilder

public interface SyntheticBuilder

A synthetic builder provides a mechanism for creating a user storable from scratch. The client creates the builder, decorates with properties and indexes on those properties, then builds. If additional, ad hoc decoration is desired, the partially constructed classfile can be retrieved and operated on directly via the ClassFileBuilder returned by prepare().

Author:
Don Schneider, David Rosenstrauch

Nested Class Summary
static interface SyntheticBuilder.ClassNameProvider
          Interface used to get the name for the class to generate.
 
Method Summary
 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(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.
 Class<? extends Storable> getStorableClass()
           
 boolean hasProperty(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()
           
 

Method Detail

prepare

ClassFileBuilder prepare()
                         throws SupportException
Returns:
ClassFileBuilder ready for further decoration or building
Throws:
SupportException

getStorableClass

Class<? extends Storable> getStorableClass()
                                           throws IllegalStateException
Returns:
the generated class file for this builder. Note that proper operation requires that prepare() already have been called prior to calling this method.
Throws:
IllegalStateException - if build has not yet been called.

build

Class<? extends Storable> build()
                                throws SupportException
Convenience method to generate the class. Build will always call 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 getStorableClass() instead.

Throws:
SupportException

addProperty

SyntheticProperty addProperty(String name,
                              Class type)
Add a property to the set managed by this builder.

Parameters:
name - of the property
type - of the property
Returns:
property specification which can be further refined

addProperty

SyntheticProperty addProperty(SyntheticProperty prop)
Add an externally defined synthetic property to the list

Parameters:
prop - to add
Returns:
original synthetic property as a convenience

hasProperty

boolean hasProperty(String name)
Check to see if a particular property has already been added to the list of properties to generate

Parameters:
name -

addPrimaryKey

SyntheticKey addPrimaryKey()
Add a primary key to be built.

Returns:
key to be decorated with property values defining the primary key

addAlternateKey

SyntheticKey addAlternateKey()
Add an alternate key to be built.

Returns:
key to be decorated with property values defining the alternate key
Since:
1.2

addIndex

SyntheticIndex addIndex()
Add an index to the set managed by this builder. All indexes added this way will be in addition to the primary and alternate key indexes.

Returns:
index to be decorated with property values defining the index

isVersioned

boolean isVersioned()
Returns true if a property with the version attribute has been addded



Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.