net.anotheria.anoprise.sessiondistributor.DistributedSessionAttribute Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ano-prise Show documentation
Show all versions of ano-prise Show documentation
Collection of utils for different enterprise class projects. Among other stuff contains
Caches, Mocking, DualCrud, MetaFactory and SessionDistributorService. Visit https://opensource.anotheria.net for details.
package net.anotheria.anoprise.sessiondistributor;
import java.io.Serializable;
/**
* DistributedSessionAttribute used in SessionDistributorService.
*
* @author lrosenberg
* @version 1.0, 2010/01/03
*/
public class DistributedSessionAttribute implements Serializable {
/**
* Basic serialVersionUID variable.
*/
private static final long serialVersionUID = 3161203681531772457L;
/**
* DistributedSessionAttribute 'name'.
* Name of the attribute.
*/
private String name;
/**
* DistributedSessionAttribute 'data'.
* Stored serialized data.
*/
private byte[] data;
/**
* Default constructor.
*
* @param aName - name
* @param someData - data
*/
public DistributedSessionAttribute(String aName, byte[] someData) {
name = aName;
data = someData;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public byte[] getData() {
return data;
}
public void setData(byte[] data) {
this.data = data;
}
private int getDataSize() {
return data == null ? 0 : data.length;
}
@Override
public String toString() {
return getName() + ", with " + getDataSize() + " bytes.";
}
@Override
public boolean equals(Object o) {
return o == this || ((o instanceof DistributedSessionAttribute) && ((DistributedSessionAttribute) o).getName().equals(getName()));
}
@Override
public int hashCode() {
return getName() != null ? getName().hashCode() : 0;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy