com.sleepycat.persist.model

## Class SecondaryKeyMetadata

- java.lang.Object
- - com.sleepycat.persist.model.FieldMetadata
  - - com.sleepycat.persist.model.SecondaryKeyMetadata

- All Implemented Interfaces:
    java.io.Serializable

      public class SecondaryKeyMetadata
      extends FieldMetadata

  The metadata for a secondary key field. A secondary key may be specified with the `SecondaryKey` annotation.

  `SecondaryKeyMetadata` objects are thread-safe. Multiple threads may safely call the methods of a shared `SecondaryKeyMetadata` object.

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SecondaryKeyMetadata(java.lang.String name, java.lang.String className, java.lang.String declaringClassName, java.lang.String elementClassName, java.lang.String keyName, Relationship relationship, java.lang.String relatedEntity, DeleteAction deleteAction)` Used by an `EntityModel` to construct secondary key metadata.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object other)`
    `DeleteAction` | `getDeleteAction()` Returns the action to take when a related entity is deleted having a primary key value that exists as a secondary key value for this entity.
    `java.lang.String` | `getElementClassName()` Returns the class name of the array or collection element for a `ONE_TO_MANY` or `MANY_TO_MANY` relationship, or null for a Relationship#ONE_TO_ONE ONE_TO_ONE} or `MANY_TO_ONE` relationship.
    `java.lang.String` | `getKeyName()` Returns the key name, which may be different from the field name.
    `java.lang.String` | `getRelatedEntity()` Returns the class name of the related (foreign) entity, for which foreign key constraints are specified using the `SecondaryKey.relatedEntity()` annotation.
    `Relationship` | `getRelationship()` Returns the relationship between instances of the entity class and the secondary keys.
    `int` | `hashCode()`

    - ### Methods inherited from class com.sleepycat.persist.model.FieldMetadata

      `getClassName, getDeclaringClassName, getName, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SecondaryKeyMetadata

          public SecondaryKeyMetadata(java.lang.String name,
                                      java.lang.String className,
                                      java.lang.String declaringClassName,
                                      java.lang.String elementClassName,
                                      java.lang.String keyName,
                                      Relationship relationship,
                                      java.lang.String relatedEntity,
                                      DeleteAction deleteAction)

      Used by an `EntityModel` to construct secondary key metadata.
      Parameters:
        `name` - the field name.
        `className` - the class name.
        `declaringClassName` - the name of the class where the field is declared.
        `elementClassName` - the element class name.
        `keyName` - the key name.
        `relationship` - the Relationship.
        `relatedEntity` - the class name of the related (foreign) entity.
        `deleteAction` - the DeleteAction.

  - ### Method Detail

    - #### getElementClassName

          public java.lang.String getElementClassName()

      Returns the class name of the array or collection element for a `ONE_TO_MANY` or `MANY_TO_MANY` relationship, or null for a Relationship#ONE_TO_ONE ONE_TO_ONE} or `MANY_TO_ONE` relationship.
      Returns:
        the element class name.

    - #### getKeyName

          public java.lang.String getKeyName()

      Returns the key name, which may be different from the field name.
      Returns:
        the key name.

    - #### getRelationship

          public Relationship getRelationship()

      Returns the relationship between instances of the entity class and the secondary keys. This may be specified using the `SecondaryKey.relate()` annotation.
      Returns:
        the Relationship.

    - #### getRelatedEntity

          public java.lang.String getRelatedEntity()

      Returns the class name of the related (foreign) entity, for which foreign key constraints are specified using the `SecondaryKey.relatedEntity()` annotation.
      Returns:
        the class name of the related (foreign) entity.

    - #### getDeleteAction

          public DeleteAction getDeleteAction()

      Returns the action to take when a related entity is deleted having a primary key value that exists as a secondary key value for this entity. This may be specified using the `SecondaryKey.onRelatedEntityDelete()` annotation.
      Returns:
        the DeleteAction.

    - #### equals

          public boolean equals(java.lang.Object other)

      Overrides:
        `equals` in class `FieldMetadata`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `FieldMetadata`

Copyright (c) 1996, 2017 Oracle and/or its affiliates. All rights reserved.