/** * Use {@link #getOriginalValue() original value} instead of * {@link #getString() current value} because they are one and the same * for non-dynamic Values and ensures that modifying dynamic Values do not * impact equality or hashCode contract. */ public int hashCode() { String str = (isDynamic()) ? getOriginalValue() : getString(); int strHash = (str == null) ? 0 : str.hashCode(); int propHash = (prop == null) ? 0 : prop.hashCode(); return strHash ^ propHash; }
/** * Use {@link #getOriginalValue() original value} instead of * {@link #getString() current value} because they are one and the same * for non-dynamic Values and ensures that modifying dynamic Values do not * impact equality or hashCode contract. */ public int hashCode() { String str = (isDynamic()) ? getOriginalValue() : getString(); int strHash = (str == null) ? 0 : str.hashCode(); int propHash = (prop == null) ? 0 : prop.hashCode(); return strHash ^ propHash; }
/** * Use {@link #getOriginalValue() original value} instead of * {@link #getString() current value} because they are one and the same * for non-dynamic Values and ensures that modifying dynamic Values do not * impact equality or hashCode contract. */ public int hashCode() { String str = (isDynamic()) ? getOriginalValue() : getString(); int strHash = (str == null) ? 0 : str.hashCode(); int propHash = (prop == null) ? 0 : prop.hashCode(); return strHash ^ propHash; }
/** * Use {@link #getOriginalValue() original value} instead of * {@link #getString() current value} because they are one and the same * for non-dynamic Values and ensures that modifying dynamic Values do not * impact equality or hashCode contract. */ public int hashCode() { String str = (isDynamic()) ? getOriginalValue() : getString(); int strHash = (str == null) ? 0 : str.hashCode(); int propHash = (prop == null) ? 0 : prop.hashCode(); return strHash ^ propHash; }
/** * Use {@link #getOriginalValue() original value} instead of * {@link #getString() current value} because they are one and the same * for non-dynamic Values and ensures that modifying dynamic Values do not * impact equality or hashCode contract. */ public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Value)) return false; Value o = (Value) other; String thisStr = (isDynamic()) ? getOriginalValue() : getString(); String thatStr = (isDynamic()) ? o.getOriginalValue() : o.getString(); return (isDynamic() == o.isDynamic()) && Objects.equals(prop, o.getProperty()) && Objects.equals(thisStr, thatStr); }
/** * Use {@link #getOriginalValue() original value} instead of * {@link #getString() current value} because they are one and the same * for non-dynamic Values and ensures that modifying dynamic Values do not * impact equality or hashCode contract. */ public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Value)) return false; Value o = (Value) other; String thisStr = (isDynamic()) ? getOriginalValue() : getString(); String thatStr = (isDynamic()) ? o.getOriginalValue() : o.getString(); return (isDynamic() == o.isDynamic()) && StringUtils.equals(prop, o.getProperty()) && StringUtils.equals(thisStr, thatStr); }
/** * Use {@link #getOriginalValue() original value} instead of * {@link #getString() current value} because they are one and the same * for non-dynamic Values and ensures that modifying dynamic Values do not * impact equality or hashCode contract. */ public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Value)) return false; Value o = (Value) other; String thisStr = (isDynamic()) ? getOriginalValue() : getString(); String thatStr = (isDynamic()) ? o.getOriginalValue() : o.getString(); return (isDynamic() == o.isDynamic()) && Objects.equals(prop, o.getProperty()) && Objects.equals(thisStr, thatStr); }
/** * Use {@link #getOriginalValue() original value} instead of * {@link #getString() current value} because they are one and the same * for non-dynamic Values and ensures that modifying dynamic Values do not * impact equality or hashCode contract. */ public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof Value)) return false; Value o = (Value) other; String thisStr = (isDynamic()) ? getOriginalValue() : getString(); String thatStr = (isDynamic()) ? o.getOriginalValue() : o.getString(); return (isDynamic() == o.isDynamic()) && StringUtils.equals(prop, o.getProperty()) && StringUtils.equals(thisStr, thatStr); }
/** * Asserts if this receiver can be changed. * Subclasses <em>must</em> invoke this method before changing its * internal state. * * This receiver can not be changed if all of the following is true * <LI>this receiver is not dynamic * <LI>ValueListener attached to this receiver is a Configuration * <LI>Configuration is read-only */ protected void assertChangeable() { if (!isDynamic() && containsReadOnlyConfigurationAsListener()) { throw new RuntimeException(s_loc.get("veto-change", this.getProperty()).toString()); } }
/** * Asserts if this receiver can be changed. * Subclasses <em>must</em> invoke this method before changing its * internal state. * * This receiver can not be changed if all of the following is true * <LI>this receiver is not dynamic * <LI>ValueListener attached to this receiver is a Configuration * <LI>Configuration is read-only */ protected void assertChangeable() { if (!isDynamic() && containsReadOnlyConfigurationAsListener()) { throw new RuntimeException(s_loc.get("veto-change", this.getProperty()).toString()); } }
/** * Asserts if this receiver can be changed. * Subclasses <em>must</em> invoke this method before changing its * internal state. * * This receiver can not be changed if all of the following is true * <LI>this receiver is not dynamic * <LI>ValueListener attached to this receiver is a Configuration * <LI>Configuration is read-only */ protected void assertChangeable() { if (!isDynamic() && containsReadOnlyConfigurationAsListener()) { throw new RuntimeException(s_loc.get("veto-change", this.getProperty()).toString()); } }
/** * Asserts if this receiver can be changed. * Subclasses <em>must</em> invoke this method before changing its * internal state. * * This receiver can not be changed if all of the following is true * <LI>this receiver is not dynamic * <LI>ValueListener attached to this receiver is a Configuration * <LI>Configuration is read-only */ protected void assertChangeable() { if (!isDynamic() && listen instanceof Configuration && ((Configuration)listen).isReadOnly()) { throw new RuntimeException(s_loc.get("veto-change", this.getProperty()).toString()); } }