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

nyla.solutions.global.data.conversation.SerializationMapKeyWrapper Maven / Gradle / Ivy

Go to download

Nyla Solutions Global Java API provides support for basic application utilities (application configuration, data encryption, debugger and text processing).

The newest version!
package nyla.solutions.global.data.conversation;

/**
 * 
 *  Wrapper for Nest Map object's for serialize.
 *  The object adds to the key class names to the text output.
 *  These addition attributes helps with de-serialization of the Map key that may not be strings.
 *  
* * @author Gregory Green * */ public class SerializationMapKeyWrapper { public SerializationMapKeyWrapper() {} /** * * @param value the object * @param valueClassName * @param key * @param keyClassName */ public SerializationMapKeyWrapper(Object key) { this(key, key.getClass().getName()); }// -------------------------------------------------------- /** * * @param value the object * @param valueClassName * @param key * @param keyClassName */ public SerializationMapKeyWrapper( Object key, String keyClassName) { this.key = key; this.keyClassName = keyClassName; } /** * @return the key */ public Object getKey() { return key; } /** * @param key the key to set */ public void setKey(Object key) { this.key = key; } /** * @return the keyClassName */ public String getKeyClassName() { return keyClassName; } /** * @param keyClassName the keyClassName to set */ public void setKeyClassName(String keyClassName) { this.keyClassName = keyClassName; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((key == null) ? 0 : key.hashCode()); result = prime * result + ((keyClassName == null) ? 0 : keyClassName.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SerializationMapKeyWrapper other = (SerializationMapKeyWrapper) obj; if (key == null) { if (other.key != null) return false; } else if (!key.equals(other.key)) return false; if (keyClassName == null) { if (other.keyClassName != null) return false; } else if (!keyClassName.equals(other.keyClassName)) return false; return true; } @Override public String toString() { return String.format( "SerializationMapKeyWrapper [key=%s, keyClassName=%s]", key, keyClassName); } private Object key; private String keyClassName; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy