From d479253768d296a40b4f699e1de9b03c7146a97a Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Tue, 3 Dec 2013 14:03:28 -0800 Subject: Adding javadocs and Carbonado User Guide --- .../amazon/carbonado/gen/StorableGenerator.html | 755 +++++++++++++++++++++ 1 file changed, 755 insertions(+) create mode 100644 apidocs/com/amazon/carbonado/gen/StorableGenerator.html (limited to 'apidocs/com/amazon/carbonado/gen/StorableGenerator.html') diff --git a/apidocs/com/amazon/carbonado/gen/StorableGenerator.html b/apidocs/com/amazon/carbonado/gen/StorableGenerator.html new file mode 100644 index 0000000..074f949 --- /dev/null +++ b/apidocs/com/amazon/carbonado/gen/StorableGenerator.html @@ -0,0 +1,755 @@ + + + + + + +StorableGenerator (Carbonado 1.2.3 API) + + + + + + + +
+ + + + + +
+ + + +
+
com.amazon.carbonado.gen
+

Class StorableGenerator<S extends Storable>

+
+
+ +
+
    +
  • +
    +
    +
    public final class StorableGenerator<S extends Storable>
    +extends java.lang.Object
    +
    Generates and caches abstract implementations of Storable + types. This greatly simplifies the process of defining new kinds of Repositories, since most of the mundane code generation is taken + care of.
    +
    Since:
    +
    1.2
    +
    Author:
    +
    Brian S O'Neill, Don Schneider, Tobias Holgers
    +
    See Also:
    MasterStorableGenerator, +DelegateStorableGenerator
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Fields 
      Modifier and TypeField and Description
      static java.lang.StringADAPTER_FIELD_ELEMENT +
      Adapter field names are propertyName + "$adapter$" + number
      +
      static java.lang.StringCHECK_PK_FOR_DELETE_METHOD_NAME +
      Name of protected method in generated storable which checks that + primary keys are initialized, throwing an exception otherwise.
      +
      static java.lang.StringCHECK_PK_FOR_INSERT_METHOD_NAME +
      Name of protected method in generated storable which checks that + primary keys are initialized, throwing an exception otherwise.
      +
      static java.lang.StringCHECK_PK_FOR_LOAD_METHOD_NAME +
      Name of protected method in generated storable which checks that + primary keys are initialized, throwing an exception otherwise.
      +
      static java.lang.StringCHECK_PK_FOR_UPDATE_METHOD_NAME +
      Name of protected method in generated storable which checks that + primary keys are initialized, throwing an exception otherwise.
      +
      static java.lang.StringCONSTRAINT_FIELD_ELEMENT +
      Constraint field names are propertyName + "$constraint$" + number
      +
      static java.lang.StringDO_TRY_DELETE_METHOD_NAME +
      Name of protected abstract method in generated storable
      +
      static java.lang.StringDO_TRY_INSERT_METHOD_NAME +
      Name of protected abstract method in generated storable
      +
      static java.lang.StringDO_TRY_LOAD_METHOD_NAME +
      Name of protected abstract method in generated storable
      +
      static java.lang.StringDO_TRY_UPDATE_METHOD_NAME +
      Name of protected abstract method in generated storable
      +
      static java.lang.StringIS_ALT_KEY_INITIALIZED_PREFIX +
      Name prefix of protected method in generated storable that returns false + if a specific alternate key is uninitialized.
      +
      static java.lang.StringIS_PARTITION_KEY_INITIALIZED_METHOD_NAME +
      Name of protected method in generated storable that returns false if any + partition keys are uninitialized.
      +
      static java.lang.StringIS_PK_INITIALIZED_METHOD_NAME +
      Name of protected method in generated storable that returns false if any + primary keys are uninitialized.
      +
      static java.lang.StringIS_REQUIRED_DATA_INITIALIZED_METHOD_NAME +
      Name of protected method in generated storable that returns false if any + non-nullable, non-pk properties are uninitialized.
      +
      static java.lang.StringIS_VERSION_INITIALIZED_METHOD_NAME +
      Name of protected method in generated storable that returns false if + version property is uninitialized.
      +
      static java.lang.StringLOAD_COMPLETED_METHOD_NAME +
      Name of protected method which must be called after load to identify all + properties as valid and to fire any load triggers.
      +
      static intPROPERTY_STATE_CLEAN +
      Property state indicating that property value reflects a clean value
      +
      static intPROPERTY_STATE_DIRTY +
      Property state indicating that property has been set, but not saved
      +
      static java.lang.StringPROPERTY_STATE_FIELD_NAME +
      Prefix of protected field in generated storable that holds property + states.
      +
      static intPROPERTY_STATE_MASK +
      Property state mask is 3, to cover the two bits used by a property state
      +
      static intPROPERTY_STATE_UNINITIALIZED +
      Property state indicating that property has never been set, loaded, or saved
      +
      static java.lang.StringSUPPORT_FIELD_NAME +
      Reference to TriggerSupport instance
      +
      +
    • +
    + +
      +
    • + + +

      Method Summary

      + + + + + + + + + + +
      Methods 
      Modifier and TypeMethod and Description
      static <S extends Storable
      java.lang.Class<? extends S>
      getAbstractClass(java.lang.Class<S> type) +
      Returns an abstract implementation of the given Storable type, which is + fully thread-safe.
      +
      +
        +
      • + + +

        Methods inherited from class java.lang.Object

        +clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • +
      +
    • +
    +
  • +
+
+
+
    +
  • + +
      +
    • + + +

      Field Detail

      + + + +
        +
      • +

        DO_TRY_LOAD_METHOD_NAME

        +
        public static final java.lang.String DO_TRY_LOAD_METHOD_NAME
        +
        Name of protected abstract method in generated storable
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        DO_TRY_INSERT_METHOD_NAME

        +
        public static final java.lang.String DO_TRY_INSERT_METHOD_NAME
        +
        Name of protected abstract method in generated storable
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        DO_TRY_UPDATE_METHOD_NAME

        +
        public static final java.lang.String DO_TRY_UPDATE_METHOD_NAME
        +
        Name of protected abstract method in generated storable
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        DO_TRY_DELETE_METHOD_NAME

        +
        public static final java.lang.String DO_TRY_DELETE_METHOD_NAME
        +
        Name of protected abstract method in generated storable
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        CHECK_PK_FOR_INSERT_METHOD_NAME

        +
        public static final java.lang.String CHECK_PK_FOR_INSERT_METHOD_NAME
        +
        Name of protected method in generated storable which checks that + primary keys are initialized, throwing an exception otherwise.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        CHECK_PK_FOR_UPDATE_METHOD_NAME

        +
        public static final java.lang.String CHECK_PK_FOR_UPDATE_METHOD_NAME
        +
        Name of protected method in generated storable which checks that + primary keys are initialized, throwing an exception otherwise.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        CHECK_PK_FOR_DELETE_METHOD_NAME

        +
        public static final java.lang.String CHECK_PK_FOR_DELETE_METHOD_NAME
        +
        Name of protected method in generated storable which checks that + primary keys are initialized, throwing an exception otherwise.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        CHECK_PK_FOR_LOAD_METHOD_NAME

        +
        public static final java.lang.String CHECK_PK_FOR_LOAD_METHOD_NAME
        +
        Name of protected method in generated storable which checks that + primary keys are initialized, throwing an exception otherwise.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        IS_PK_INITIALIZED_METHOD_NAME

        +
        public static final java.lang.String IS_PK_INITIALIZED_METHOD_NAME
        +
        Name of protected method in generated storable that returns false if any + primary keys are uninitialized.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        IS_PARTITION_KEY_INITIALIZED_METHOD_NAME

        +
        public static final java.lang.String IS_PARTITION_KEY_INITIALIZED_METHOD_NAME
        +
        Name of protected method in generated storable that returns false if any + partition keys are uninitialized.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        IS_ALT_KEY_INITIALIZED_PREFIX

        +
        public static final java.lang.String IS_ALT_KEY_INITIALIZED_PREFIX
        +
        Name prefix of protected method in generated storable that returns false + if a specific alternate key is uninitialized. The complete name is + formed by the prefix appended with the zero-based alternate key number.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        IS_REQUIRED_DATA_INITIALIZED_METHOD_NAME

        +
        public static final java.lang.String IS_REQUIRED_DATA_INITIALIZED_METHOD_NAME
        +
        Name of protected method in generated storable that returns false if any + non-nullable, non-pk properties are uninitialized.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        IS_VERSION_INITIALIZED_METHOD_NAME

        +
        public static final java.lang.String IS_VERSION_INITIALIZED_METHOD_NAME
        +
        Name of protected method in generated storable that returns false if + version property is uninitialized. If no version property exists, then + this method is not defined.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        LOAD_COMPLETED_METHOD_NAME

        +
        public static final java.lang.String LOAD_COMPLETED_METHOD_NAME
        +
        Name of protected method which must be called after load to identify all + properties as valid and to fire any load triggers.
        +
        Since:
        +
        1.2
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        PROPERTY_STATE_FIELD_NAME

        +
        public static final java.lang.String PROPERTY_STATE_FIELD_NAME
        +
        Prefix of protected field in generated storable that holds property + states. Each property consumes two bits to hold its state, and so each + 32-bit field holds states for up to 16 properties.
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        ADAPTER_FIELD_ELEMENT

        +
        public static final java.lang.String ADAPTER_FIELD_ELEMENT
        +
        Adapter field names are propertyName + "$adapter$" + number
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        CONSTRAINT_FIELD_ELEMENT

        +
        public static final java.lang.String CONSTRAINT_FIELD_ELEMENT
        +
        Constraint field names are propertyName + "$constraint$" + number
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        SUPPORT_FIELD_NAME

        +
        public static final java.lang.String SUPPORT_FIELD_NAME
        +
        Reference to TriggerSupport instance
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        PROPERTY_STATE_UNINITIALIZED

        +
        public static final int PROPERTY_STATE_UNINITIALIZED
        +
        Property state indicating that property has never been set, loaded, or saved
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        PROPERTY_STATE_DIRTY

        +
        public static final int PROPERTY_STATE_DIRTY
        +
        Property state indicating that property has been set, but not saved
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        PROPERTY_STATE_CLEAN

        +
        public static final int PROPERTY_STATE_CLEAN
        +
        Property state indicating that property value reflects a clean value
        +
        See Also:
        Constant Field Values
        +
      • +
      + + + +
        +
      • +

        PROPERTY_STATE_MASK

        +
        public static final int PROPERTY_STATE_MASK
        +
        Property state mask is 3, to cover the two bits used by a property state
        +
        See Also:
        Constant Field Values
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        getAbstractClass

        +
        public static <S extends Storable> java.lang.Class<? extends S> getAbstractClass(java.lang.Class<S> type)
        +                                                                      throws java.lang.IllegalArgumentException
        +
        Returns an abstract implementation of the given Storable type, which is + fully thread-safe. The Storable type itself may be an interface or a + class. If it is a class, then it must not be final, and it must have a + public, no-arg constructor. The constructor signature for the returned + abstract class is defined as follows: + +
        + /**
        +  * @param support  Access to triggers
        +  */
        + public <init>(TriggerSupport support);
        + 
        + +

        Subclasses must implement the following abstract protected methods, + whose exact names are defined by constants in this class: + +

        + // Load the object by examining the primary key.
        + protected abstract boolean doTryLoad() throws FetchException;
        +
        + // Insert the object into the storage layer.
        + protected abstract boolean doTryInsert() throws PersistException;
        +
        + // Update the object in the storage.
        + protected abstract boolean doTryUpdate() throws PersistException;
        +
        + // Delete the object from the storage layer by the primary key.
        + protected abstract boolean doTryDelete() throws PersistException;
        + 
        + + A set of protected hook methods are provided which ensure that all + primary keys are initialized before performing a repository + operation. Subclasses may override them, if they are capable of filling + in unspecified primary keys. One such example is applying a sequence on + insert. + +
        + // Throws exception if any primary keys are uninitialized.
        + // Actual method name defined by CHECK_PK_FOR_INSERT_METHOD_NAME.
        + protected void checkPkForInsert() throws IllegalStateException;
        +
        + // Throws exception if any primary keys are uninitialized.
        + // Actual method name defined by CHECK_PK_FOR_UPDATE_METHOD_NAME.
        + protected void checkPkForUpdate() throws IllegalStateException;
        +
        + // Throws exception if any primary keys are uninitialized.
        + // Actual method name defined by CHECK_PK_FOR_DELETE_METHOD_NAME.
        + protected void checkPkForDelete() throws IllegalStateException;
        + 
        + + Each property value is defined as a protected field whose name and type + matches the property. Subclasses should access these fields directly + during loading and storing. For loading, it bypasses constraint + checks. For both, it provides better performance. + +

        Subclasses also have access to a set of property state bits stored + in protected int fields. Subclasses are not responsible for updating + these values. The intention is that these states may be used by + subclasses to support partial updates. They may otherwise be ignored. + +

        As a convenience, protected methods are provided to test and alter + the property state bits. Subclass constructors that fill all properties + with loaded values must call loadCompleted to ensure all properties are + identified as being valid and to fire any load triggers. + +

        + // Returns true if all primary key properties have been set.
        + protected boolean isPkInitialized();
        +
        + // Returns true if all partition key properties have been set.
        + protected boolean isPartitionKeyInitialized();
        +
        + // Returns true if all required data properties are set.
        + // A required data property is a non-nullable, non-primary key.
        + protected boolean isRequiredDataInitialized();
        +
        + // Returns true if a version property has been set.
        + // Note: This method is not generated if there is no version property.
        + protected boolean isVersionInitialized();
        +
        + // Must be called after load to identify all properties as valid
        + // and to fire any load triggers.
        + // Actual method name defined by LOAD_COMPLETED_METHOD_NAME.
        + protected void loadCompleted() throws FetchException;
        + 
        + + Property state field names are defined by the concatenation of + PROPERTY_STATE_FIELD_NAME and a zero-based decimal + number. To determine which field holds a particular property's state, + the field number is computed as the property number divided by 16. The + specific two-bit state position is the remainder of this division times 2.
        +
        Throws:
        +
        MalformedTypeException - if Storable type is not well-formed
        +
        java.lang.IllegalArgumentException - if type is null
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + +
+ + +

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

+ + -- cgit v1.2.3