diff options
| -rw-r--r-- | src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java | 12 | ||||
| -rw-r--r-- | src/main/java/com/amazon/carbonado/raw/StorableCodec.java | 9 | 
2 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java b/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java index 681909a..92a6473 100644 --- a/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java +++ b/src/main/java/com/amazon/carbonado/raw/GenericStorableCodec.java @@ -358,6 +358,18 @@ public class GenericStorableCodec<S extends Storable> implements StorableCodec<S      }
      /**
 +     * Instantiate a Storable with no value defined yet. The default {@link
 +     * RawSupport} is supplied to the instance.
 +     *
 +     * @throws IllegalStateException if no default support exists
 +     * @since 1.2
 +     */
 +    @SuppressWarnings("unchecked")
 +    public S instantiate(byte[] key) throws FetchException {
 +        return (S) mInstanceFactory.instantiate(support(), key);
 +    }
 +
 +    /**
       * Instantiate a Storable with a specific key and value. The default
       * {@link RawSupport} is supplied to the instance.
       *
 diff --git a/src/main/java/com/amazon/carbonado/raw/StorableCodec.java b/src/main/java/com/amazon/carbonado/raw/StorableCodec.java index 58f6531..8945861 100644 --- a/src/main/java/com/amazon/carbonado/raw/StorableCodec.java +++ b/src/main/java/com/amazon/carbonado/raw/StorableCodec.java @@ -45,6 +45,15 @@ public interface StorableCodec<S extends Storable> {      S instantiate();
      /**
 +     * Instantiate a Storable with no value defined yet. The default {@link
 +     * RawSupport} is supplied to the instance.
 +     *
 +     * @throws IllegalStateException if no default support exists
 +     * @since 1.2
 +     */
 +    S instantiate(byte[] key) throws FetchException;
 +
 +    /**
       * Instantiate a Storable with a specific key and value. The default
       * {@link RawSupport} is supplied to the instance.
       *
  | 
