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 sample.contact;
    17
    18  import java.io.Serializable;
    19
    20
    21  /***
    22   * Represents a contact.
    23   *
    24   * @author Ben Alex
    25   * @version $Id: Contact.java,v 1.5 2005/11/04 04:15:57 benalex Exp $
    26   */
    27  public class Contact implements Serializable {
    28      //~ Instance fields ========================================================
    29
    30      private Long id;
    31      private String email;
    32      private String name;
    33
    34      //~ Constructors ===========================================================
    35
    36      public Contact(String name, String email) {
    37          this.name = name;
    38          this.email = email;
    39      }
    40
    41      public Contact() {}
    42
    43      //~ Methods ================================================================
    44
    45      /***
    46       * DOCUMENT ME!
    47       *
    48       * @param email The email to set.
    49       */
    50      public void setEmail(String email) {
    51          this.email = email;
    52      }
    53
    54      /***
    55       * DOCUMENT ME!
    56       *
    57       * @return Returns the email.
    58       */
    59      public String getEmail() {
    60          return email;
    61      }
    62
    63      public void setId(Long id) {
    64          this.id = id;
    65      }
    66
    67      /***
    68       * DOCUMENT ME!
    69       *
    70       * @return Returns the id.
    71       */
    72      public Long getId() {
    73          return id;
    74      }
    75
    76      /***
    77       * DOCUMENT ME!
    78       *
    79       * @param name The name to set.
    80       */
    81      public void setName(String name) {
    82          this.name = name;
    83      }
    84
    85      /***
    86       * DOCUMENT ME!
    87       *
    88       * @return Returns the name.
    89       */
    90      public String getName() {
    91          return name;
    92      }
    93
    94      public String toString() {
    95          StringBuffer sb = new StringBuffer();
    96          sb.append(super.toString() + ": ");
    97          sb.append("Id: " + this.getId() + "; ");
    98          sb.append("Name: " + this.getName() + "; ");
    99          sb.append("Email: " + this.getEmail());
    100
    101         return sb.toString();
    102     }
    103 }