com.h3c.sdn

## Class AbstractModel<T,I extends Serializable>

- java.lang.Object
- - com.h3c.sdn.AbstractModel<T,I>

- Type Parameters:
    `T` - type of the transfer object (DTO)
    `I` - type of the id
  All Implemented Interfaces:
    Transportable<T,I>, Serializable
  Direct Known Subclasses:
    LicenseKey, LicInstallId, Model

      public abstract class AbstractModel<T,I extends Serializable>
      extends Object
      implements Transportable<T,I>

  Abstract model object. TODO: This class is meant to replace `BaseModel`.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractModel()` Creates a transfer object with no identity.
    `AbstractModel(Id<? extends T,I> id)` Creates a transfer object.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `<E extends T> Id<E,I>` | `getId()` Gets the id of this object.
    `int` | `hashCode()`
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### AbstractModel

          public AbstractModel()

      Creates a transfer object with no identity.

    - #### AbstractModel

          public AbstractModel(Id<? extends T,I> id)

      Creates a transfer object.
      Parameters:
        `id` - transfer object's identity

  - ### Method Detail

    - #### getId

          public <E extends T> Id<E,I> getId()

      Description copied from interface: `Transportable`
      Gets the id of this object.

      A type for the identified must be specified to retrieve the id because identified objects might be inheritable. For example, assume `Employee` extends from `Person` and `Person` implements `Transportable<Person, Long>`. The following code would be possible.

           Id<Person, Long> id = employee.getId();
           Id<Employee, Long> id = employee.getId();

      Specified by:
        `getId` in interface `Transportable<T,I extends Serializable>`
      Returns:
        the id of this object

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2014. All Rights Reserved.