View Javadoc

    1   /* Copyright 2004, 2005 Acegi Technology Pty Limited
    2    *
    3    * Licensed under the Apache License, Version 2.0 (the "License");
    4    * you may not use this file except in compliance with the License.
    5    * You may obtain a copy of the License at
    6    *
    7    *     http://www.apache.org/licenses/LICENSE-2.0
    8    *
    9    * Unless required by applicable law or agreed to in writing, software
    10   * distributed under the License is distributed on an "AS IS" BASIS,
    11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12   * See the License for the specific language governing permissions and
    13   * limitations under the License.
    14   */
    15
    16  package org.acegisecurity.domain.impl;
    17
    18  import java.io.Serializable;
    19
    20  /***
    21   * A persistable entity that uses a <code>Long</code> based identity.
    22   *
    23   * @author Ben Alex
    24   * @version $Id: PersistableEntityLong.java,v 1.7 2005/11/17 00:55:49 benalex Exp $
    25   */
    26  public abstract class PersistableEntityLong extends AbstractPersistableEntity {
    27      //~ Instance fields ========================================================
    28
    29      protected Long id;
    30
    31      //~ Methods ================================================================
    32
    33
    34      /***
    35       * DO NOT USE DIRECTLY.
    36       *
    37       * <p>
    38       * Typically only used by the persistence layer, but provided with public
    39       * visibility to not limit flexibility.
    40       * </p>
    41       *
    42       * @param id the new instance identity
    43       */
    44      public void setId(Long id) {
    45          this.id = id;
    46      }
    47
    48      /***
    49       * Obtains the persistence identity of this instance.
    50       */
    51      public Long getId() {
    52      	return this.id;
    53      }
    54
    55      /***
    56       * DO NOT USE DIRECTLY.
    57       *
    58       * <p>
    59       * Use {@link #getId()} instead, as it provides the correct return type.
    60       * This method is only provided for use by the persistence layer and to
    61       * satisfy the {@link org.acegisecurity.domain.PersistableEntity}
    62       * interface contract.
    63       * </p>
    64       *
    65       * <p>
    66       * Internally delegates to {@link #getId()}.
    67       * </p>
    68       *
    69       * @return the instance's identity
    70       */
    71      public Serializable getInternalId() {
    72          return this.getId();
    73      }
    74  }