1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 *
19 */
20
21 package org.apache.directory.api.ldap.trigger;
22
23
24 /**
25 * An enumeration that represents action times
26 * for an LDAP trigger specification.
27 *
28 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
29 */
30 public final class ActionTime
31 {
32 /** The AFTER instance. */
33 public static final ActionTime AFTER = new ActionTime( "AFTER" );
34
35 /** The name. */
36 private final String name;
37
38
39 private ActionTime( String name )
40 {
41 this.name = name;
42 }
43
44
45 /**
46 * Returns the name of this action time.
47 *
48 * @return the name of this action time.
49 */
50 public String getName()
51 {
52 return name;
53 }
54
55
56 /**
57 * {@inheritDoc}
58 */
59 @Override
60 public String toString()
61 {
62 return name;
63 }
64
65
66 /**
67 * {@inheritDoc}
68 */
69 @Override
70 public int hashCode()
71 {
72 int h = 37;
73 h = h * 17 + ( ( name == null ) ? 0 : name.hashCode() );
74
75 return h;
76 }
77
78
79 /**
80 * {@inheritDoc}
81 */
82 @Override
83 public boolean equals( Object obj )
84 {
85 if ( this == obj )
86 {
87 return true;
88 }
89 if ( obj == null )
90 {
91 return false;
92 }
93 if ( getClass() != obj.getClass() )
94 {
95 return false;
96 }
97 final ActionTime other = ( ActionTime ) obj;
98 if ( name == null )
99 {
100 if ( other.name != null )
101 {
102 return false;
103 }
104 }
105 else if ( !name.equals( other.name ) )
106 {
107 return false;
108 }
109 return true;
110 }
111 }