View Javadoc

    1   package org.codehaus.xfire.handler;
    2
    3   public class Phase
    4       implements Comparable
    5   {
    6       public final static String TRANSPORT = "transport";
    7       public final static String PARSE = "parse";
    8       public final static String PRE_DISPATCH = "pre-dispatch";
    9       public final static String DISPATCH = "dispatch";
    10      public final static String POLICY = "policy";
    11      public final static String USER = "user";
    12      public final static String PRE_INVOKE = "pre-invoke";
    13      public final static String SERVICE = "service";
    14      public final static String POST_INVOKE = "post-invoke";
    15      public final static String SEND = "send";
    16
    17      private String name;
    18      private int priority;
    19
    20      public Phase(String name, int priority)
    21      {
    22          this.name = name;
    23          this.priority = priority;
    24      }
    25      public String getName()
    26      {
    27          return name;
    28      }
    29      public void setName(String name)
    30      {
    31          this.name = name;
    32      }
    33      public int getPriority()
    34      {
    35          return priority;
    36      }
    37      public void setPriority(int priority)
    38      {
    39          this.priority = priority;
    40      }
    41
    42      public boolean equals(Object obj)
    43      {
    44          if (obj.hashCode() != hashCode())
    45              return false;
    46
    47          if (!(obj instanceof Phase))
    48              return false;
    49
    50          Phase p = (Phase) obj;
    51          if (p.getName().equals(name) && p.getPriority() == priority)
    52          {
    53              return true;
    54          }
    55
    56          return false;
    57      }
    58
    59      public int hashCode()
    60      {
    61          return priority ^= name.hashCode();
    62      }
    63
    64      public int compareTo(Object obj)
    65      {
    66          Phase phase = (Phase) obj;
    67
    68          int p2 = phase.getPriority();
    69          if (p2 < priority) return 1;
    70          if (p2 > priority) return -1;
    71
    72          return phase.getName().compareTo(name);
    73      }
    74
    75
    76  }