com.dooapp.gaedo.blueprints.transformers.WriteableKeyEntry Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gaedo-blueprints Show documentation
Show all versions of gaedo-blueprints Show documentation
Implementation of gaedo mechanisms backed by blueprints graph layer
package com.dooapp.gaedo.blueprints.transformers;
import java.util.Map;
import java.util.Map.Entry;
/**
* An impelmentation of {@link Entry} allowing us to write key, very useful to load objects !
* @author ndx
*
* @param
* @param
*/
public class WriteableKeyEntry implements Map.Entry {
private K key;
private V value;
public WriteableKeyEntry() {
}
public WriteableKeyEntry(K key, V value) {
setKey(key);
setValue(value);
}
@Override
public K getKey() {
return key;
}
@Override
public V getValue() {
return value;
}
@Override
public V setValue(V value) {
V old = this.value;
this.value = value;
return old;
}
/**
* @param value new value for #value
* @category fluent
* @category setter
* @category value
* @return this object for chaining calls
*/
public WriteableKeyEntry withValue(V value) {
this.setValue(value);
return this;
}
public K setKey(K key) {
K old = this.key;
this.key = key;
return old;
}
/**
* @param key new value for #key
* @category fluent
* @category setter
* @category key
* @return this object for chaining calls
*/
public WriteableKeyEntry withKey(K key) {
this.setKey(key);
return this;
}
/**
* @return
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("WriteableKeyEntry [");
if (key != null) {
builder.append("key=");
builder.append(key);
builder.append(", ");
}
if (value != null) {
builder.append("value=");
builder.append(value);
}
builder.append("]");
return builder.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy