001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *  
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *  
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License. 
018 *  
019 */
020
021package org.apache.directory.api.ldap.trigger;
022
023
024/**
025 * An enumeration that represents action times
026 * for an LDAP trigger specification.
027 * 
028 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
029 */
030public final class ActionTime
031{
032    /** The AFTER instance. */
033    public static final ActionTime AFTER = new ActionTime( "AFTER" );
034
035    /** The name. */
036    private final String name;
037
038
039    private ActionTime( String name )
040    {
041        this.name = name;
042    }
043
044
045    /**
046     * Returns the name of this action time.
047     *
048     * @return the name of this action time.
049     */
050    public String getName()
051    {
052        return name;
053    }
054
055
056    /**
057     * {@inheritDoc}
058     */
059    @Override
060    public String toString()
061    {
062        return name;
063    }
064
065
066    /**
067     * {@inheritDoc}
068     */
069    @Override
070    public int hashCode()
071    {
072        int h = 37;
073        h = h * 17 + ( ( name == null ) ? 0 : name.hashCode() );
074
075        return h;
076    }
077
078
079    /**
080     * {@inheritDoc}
081     */
082    @Override
083    public boolean equals( Object obj )
084    {
085        if ( this == obj )
086        {
087            return true;
088        }
089        if ( obj == null )
090        {
091            return false;
092        }
093        if ( getClass() != obj.getClass() )
094        {
095            return false;
096        }
097        final ActionTime other = ( ActionTime ) obj;
098        if ( name == null )
099        {
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}