All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.openejb.assembler.classic.ComparableValidationConfig Maven / Gradle / Ivy

The newest version!
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.openejb.assembler.classic;

import java.io.Serializable;
import java.util.List;
import java.util.Properties;

public class ComparableValidationConfig implements Serializable {
    private final String providerClassName;
    private final String messageInterpolatorClass;
    private final String traversableResolverClass;
    private final String constraintFactoryClass;
    private final Properties propertyTypes;
    private final List constraintMappings;

    private final int hash;

    public ComparableValidationConfig(final String providerClassName, final String messageInterpolatorClass,
                                      final String traversableResolverClass, final String constraintFactoryClass,
                                      final Properties propertyTypes, final List constraintMappings) {
        this.providerClassName = providerClassName;
        this.messageInterpolatorClass = messageInterpolatorClass;
        this.traversableResolverClass = traversableResolverClass;
        this.constraintFactoryClass = constraintFactoryClass;
        this.propertyTypes = propertyTypes;
        this.constraintMappings = constraintMappings;

        int result = providerClassName != null ? providerClassName.hashCode() : 0;
        result = 31 * result + (messageInterpolatorClass != null ? messageInterpolatorClass.hashCode() : 0);
        result = 31 * result + (traversableResolverClass != null ? traversableResolverClass.hashCode() : 0);
        result = 31 * result + (constraintFactoryClass != null ? constraintFactoryClass.hashCode() : 0);
        result = 31 * result + (propertyTypes != null ? propertyTypes.hashCode() : 0);
        result = 31 * result + (constraintMappings != null ? constraintMappings.hashCode() : 0);
        hash = result;
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        final ComparableValidationConfig that = (ComparableValidationConfig) o;

        if (constraintFactoryClass != null ? !constraintFactoryClass.equals(that.constraintFactoryClass) : that.constraintFactoryClass != null) {
            return false;
        }
        if (constraintMappings != null ? !constraintMappings.equals(that.constraintMappings) : that.constraintMappings != null) {
            return false;
        }
        if (messageInterpolatorClass != null ? !messageInterpolatorClass.equals(that.messageInterpolatorClass) : that.messageInterpolatorClass != null) {
            return false;
        }
        if (propertyTypes != null ? !propertyTypes.equals(that.propertyTypes) : that.propertyTypes != null) {
            return false;
        }
        if (providerClassName != null ? !providerClassName.equals(that.providerClassName) : that.providerClassName != null) {
            return false;
        }
        if (traversableResolverClass != null ? !traversableResolverClass.equals(that.traversableResolverClass) : that.traversableResolverClass != null) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        return hash;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy