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 * The language schema option of triggered stored procedure.
026 * 
027 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
028 */
029public class StoredProcedureLanguageSchemeOption implements StoredProcedureOption
030{
031
032    private String language;
033
034
035    /**
036     * Instantiates a new stored procedure language scheme option.
037     *
038     * @param language the language
039     */
040    public StoredProcedureLanguageSchemeOption( String language )
041    {
042        this.language = language;
043    }
044
045
046    /**
047     * Gets the language.
048     *
049     * @return the language
050     */
051    public String getLanguage()
052    {
053        return language;
054    }
055
056
057    /**
058     * {@inheritDoc}
059     */
060    @Override
061    public String toString()
062    {
063        return "language " + "\"" + language + "\"";
064    }
065
066
067    /**
068     * {@inheritDoc}
069     */
070    @Override
071    public int hashCode()
072    {
073        int h = 37;
074
075        h = h * 17 + ( ( language == null ) ? 0 : language.hashCode() );
076
077        return h;
078    }
079
080
081    /**
082     * {@inheritDoc}
083     */
084    @Override
085    public boolean equals( Object obj )
086    {
087        if ( this == obj )
088        {
089            return true;
090        }
091        if ( obj == null )
092        {
093            return false;
094        }
095        if ( getClass() != obj.getClass() )
096        {
097            return false;
098        }
099        final StoredProcedureLanguageSchemeOption other = ( StoredProcedureLanguageSchemeOption ) obj;
100        if ( language == null )
101        {
102            if ( other.language != null )
103            {
104                return false;
105            }
106        }
107        else if ( !language.equals( other.language ) )
108        {
109            return false;
110        }
111        return true;
112    }
113
114}