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

tech.jhipster.config.cache.PrefixedSimpleKey Maven / Gradle / Ivy

Go to download

Server-side library used by applications created with the JHipster generator, see https://www.jhipster.tech/ for more information on JHipster

There is a newer version: 8.7.2
Show newest version
package tech.jhipster.config.cache;

import java.io.Serializable;
import java.util.Arrays;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

/**
 * 

PrefixedSimpleKey class.

*/ public class PrefixedSimpleKey implements Serializable { private final String prefix; private transient Object[] params; private final String methodName; private int hashCodeValue; /** *

Constructor for PrefixedSimpleKey.

* * @param prefix a {@link java.lang.String} object. * @param methodName a {@link java.lang.String} object. * @param elements a {@link java.lang.Object} object. */ public PrefixedSimpleKey(String prefix, String methodName, Object... elements) { Assert.notNull(prefix, "Prefix must not be null"); Assert.notNull(elements, "Elements must not be null"); this.prefix = prefix; this.methodName = methodName; params = new Object[elements.length]; System.arraycopy(elements, 0, params, 0, elements.length); hashCodeValue = prefix.hashCode(); hashCodeValue = 31 * hashCodeValue + methodName.hashCode(); hashCodeValue = 31 * hashCodeValue + Arrays.deepHashCode(params); } /** {@inheritDoc} */ @Override public boolean equals(Object other) { return ( this == other || (other instanceof PrefixedSimpleKey && prefix.equals(((PrefixedSimpleKey) other).prefix) && methodName.equals(((PrefixedSimpleKey) other).methodName) && Arrays.deepEquals(params, ((PrefixedSimpleKey) other).params)) ); } /** {@inheritDoc} */ @Override public final int hashCode() { return hashCodeValue; } /** {@inheritDoc} */ @Override public String toString() { return prefix + " " + getClass().getSimpleName() + methodName + " [" + StringUtils.arrayToCommaDelimitedString(params) + "]"; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy