View Javadoc

    1   /* ***********************************************************************************
    2    * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved.                 *
    3    * http://aspectwerkz.codehaus.org                                                    *
    4    * ---------------------------------------------------------------------------------- *
    5    * The software in this package is published under the terms of the LGPL license      *
    6    * a copy of which has been included with this distribution in the license.txt file.  *
    7    * ************************************************************************************/
    8   package org.codehaus.aspectwerkz.aspect;
    9
    10  import java.io.Serializable;
    11
    12  /***
    13   * Type-safe enum for the advice types.
    14   *
    15   * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
    16   */
    17  public class AdviceType implements Serializable {
    18
    19      public static final AdviceType AROUND = new AdviceType("AROUND");
    20      public static final AdviceType BEFORE = new AdviceType("BEFORE");
    21      public static final AdviceType AFTER = new AdviceType("AFTER");
    22      public static final AdviceType AFTER_FINALLY = new AdviceType("AFTER_FINALLY");
    23      public static final AdviceType AFTER_RETURNING = new AdviceType("AFTER_RETURNING");
    24      public static final AdviceType AFTER_THROWING = new AdviceType("AFTER_THROWING");
    25
    26      private final String m_name;
    27
    28      private AdviceType(String name) {
    29          m_name = name;
    30      }
    31
    32      public String toString() {
    33          return m_name;
    34      }
    35
    36      public boolean equals(Object o) {
    37          if (this == o) {
    38              return true;
    39          }
    40          if (!(o instanceof AdviceType)) {
    41              return false;
    42          }
    43          final AdviceType adviceType = (AdviceType) o;
    44          if ((m_name != null) ? (!m_name.equals(adviceType.m_name)) : (adviceType.m_name != null)) {
    45              return false;
    46          }
    47          return true;
    48      }
    49
    50      public int hashCode() {
    51          return ((m_name != null) ? m_name.hashCode() : 0);
    52      }
    53  }