Package org.apache.cayenne.util

Examples of org.apache.cayenne.util.HashCodeBuilder


    @Override
    public int hashCode() {

        if (this.hashCode == 0) {

            HashCodeBuilder builder = new HashCodeBuilder(3, 5);
            builder.append(entityName.hashCode());

            if (key != null) {
                builder.append(key);
            }
            else if (singleKey != null) {
                builder.append(singleKey.hashCode());

                // must reconcile all possible numeric types
                if (singleValue instanceof Number) {
                    builder.append(((Number) singleValue).longValue());
                }
                else {
                    builder.append(singleValue);
                }
            }
            else if (objectIdKeys != null) {
                int len = objectIdKeys.size();

                // handle multiple keys - must sort the keys to use with HashCodeBuilder

                Object[] keys = objectIdKeys.keySet().toArray();
                Arrays.sort(keys);

                for (int i = 0; i < len; i++) {
                    // HashCodeBuilder will take care of processing object if it
                    // happens to be a primitive array such as byte[]

                    // also we don't have to append the key hashcode, its index will
                    // work
                    builder.append(i);

                    Object value = objectIdKeys.get(keys[i]);
                    // must reconcile all possible numeric types
                    if (value instanceof Number) {
                        builder.append(((Number) value).longValue());
                    }
                    else {
                        builder.append(value);
                    }
                }
            }

            this.hashCode = builder.toHashCode();
            assert hashCode != 0 : "Generated zero hashCode";
        }

        return hashCode;
    }
View Full Code Here


        this.eventBridgeParameters = eventBridgeParameters;
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(71, 5).append(sessionId).toHashCode();
    }
View Full Code Here

    /**
     * @since 1.2
     */
    @Override
    public int hashCode() {
        return new HashCodeBuilder(23, 43)
                .append(name)
                .append(qualifiedColumnName)
                .append(procedureName)
                .append(tableName)
                .append(label)
View Full Code Here

            return false;
        }

        @Override
        public int hashCode() {
            return new HashCodeBuilder(31, 5)
                    .append(alias)
                    .append(attribute)
                    .toHashCode();
        }
View Full Code Here

    @Override
    public int hashCode() {

        if (this.hashCode == 0) {

            HashCodeBuilder builder = new HashCodeBuilder(13, 17);

            if (name != null) {
                builder.append(name.hashCode());
            }

            if (parameters != null) {
                Object[] keys = parameters.keySet().toArray();
                Arrays.sort(keys);

                for (Object key : keys) {
                    // HashCodeBuilder will take care of processing object if it
                    // happens to be a primitive array such as byte[]
                    builder.append(key).append(parameters.get(key));
                }

            }

            this.hashCode = builder.toHashCode();
            assert hashCode != 0 : "Generated zero hashCode";
        }

        return hashCode;
    }
View Full Code Here

    @Override
    public int hashCode() {

        if (this.hashCode == 0) {

            HashCodeBuilder builder = new HashCodeBuilder(13, 17);

            if (name != null) {
                builder.append(name.hashCode());
            }

            if (parameters != null) {
                Object[] keys = parameters.keySet().toArray();
                Arrays.sort(keys);

                for (Object key : keys) {
                    // HashCodeBuilder will take care of processing object if it
                    // happens to be a primitive array such as byte[]
                    builder.append(key).append(parameters.get(key));
                }

            }

            this.hashCode = builder.toHashCode();
            assert hashCode != 0 : "Generated zero hashCode";
        }

        return hashCode;
    }
View Full Code Here

        return false;
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 3).append(_fullyQualifiedSubjectName).toHashCode();
    }
View Full Code Here

    /**
     * @since 1.2
     */
    @Override
    public int hashCode() {
        return new HashCodeBuilder(23, 43)
                .append(name)
                .append(qualifiedColumnName)
                .append(procedureName)
                .append(tableName)
                .append(label)
View Full Code Here

            return false;
        }

        @Override
        public int hashCode() {
            return new HashCodeBuilder(31, 5)
                    .append(alias)
                    .append(attribute)
                    .toHashCode();
        }
View Full Code Here

    @Override
    public int hashCode() {

        if (this.hashCode == 0) {

            HashCodeBuilder builder = new HashCodeBuilder(13, 17);

            if (name != null) {
                builder.append(name.hashCode());
            }

            if (parameters != null) {
                Object[] keys = parameters.keySet().toArray();
                Arrays.sort(keys);

                for (Object key : keys) {
                    // HashCodeBuilder will take care of processing object if it
                    // happens to be a primitive array such as byte[]
                    builder.append(key).append(parameters.get(key));
                }

            }

            this.hashCode = builder.toHashCode();
            assert hashCode != 0 : "Generated zero hashCode";
        }

        return hashCode;
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.util.HashCodeBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.