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.expression;
    9
    10  import java.io.Serializable;
    11
    12  /***
    13   * Type-safe enum for the pointcut types.
    14   *
    15   * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
    16   */
    17  public class PointcutType implements Serializable {
    18      public static final PointcutType EXECUTION = new PointcutType("execution");
    19
    20      public static final PointcutType CALL = new PointcutType("call");
    21
    22      public static final PointcutType SET = new PointcutType("set");
    23
    24      public static final PointcutType GET = new PointcutType("get");
    25
    26      public static final PointcutType HANDLER = new PointcutType("handler");
    27
    28      public static final PointcutType WITHIN = new PointcutType("within");
    29  //
    30  //    public static final PointcutType WITHIN_CODE = new PointcutType("withincode");
    31
    32      public static final PointcutType STATIC_INITIALIZATION = new PointcutType("staticinitialization");
    33
    34  //    public static final PointcutType ATTRIBUTE = new PointcutType("attribute");
    35  //
    36  //    public static final PointcutType HAS_METHOD = new PointcutType("hasmethod");
    37  //
    38  //    public static final PointcutType HAS_FIELD = new PointcutType("hasfield");
    39  //
    40  //    public static final PointcutType ANY = new PointcutType("any");
    41
    42      private final String m_name;
    43
    44      private PointcutType(String name) {
    45          m_name = name;
    46      }
    47
    48      public String toString() {
    49          return m_name;
    50      }
    51
    52      public boolean equals(Object o) {
    53          if (this == o) {
    54              return true;
    55          }
    56          if (!(o instanceof PointcutType)) {
    57              return false;
    58          }
    59          final PointcutType pointcutType = (PointcutType) o;
    60          if ((m_name != null) ? (!m_name.equals(pointcutType.m_name)) : (pointcutType.m_name != null)) {
    61              return false;
    62          }
    63          return true;
    64      }
    65
    66      public int hashCode() {
    67          return ((m_name != null) ? m_name.hashCode() : 0);
    68      }
    69  }