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 *    https://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 int hashCode()
062    {
063        int h = 37;
064
065        h = h * 17 + ( ( language == null ) ? 0 : language.hashCode() );
066
067        return h;
068    }
069
070
071    /**
072     * {@inheritDoc}
073     */
074    @Override
075    public boolean equals( Object obj )
076    {
077        if ( this == obj )
078        {
079            return true;
080        }
081        
082        if ( obj == null )
083        {
084            return false;
085        }
086        
087        if ( getClass() != obj.getClass() )
088        {
089            return false;
090        }
091        
092        StoredProcedureLanguageSchemeOption other = ( StoredProcedureLanguageSchemeOption ) obj;
093     
094        if ( language == null )
095        {
096            if ( other.language != null )
097            {
098                return false;
099            }
100        }
101        else if ( !language.equals( other.language ) )
102        {
103            return false;
104        }
105        
106        return true;
107    }
108
109
110    /**
111     * {@inheritDoc}
112     */
113    @Override
114    public String toString()
115    {
116        return "language " + "\"" + language + "\"";
117    }
118}