org.nakedobjects.nos.remote.command.AbstractRequest Maven / Gradle / Ivy
package org.nakedobjects.nos.remote.command;
import java.io.Serializable;
import org.nakedobjects.noa.security.Session;
import org.nakedobjects.noa.util.ByteDecoder;
import org.nakedobjects.noa.util.ByteEncoder;
public abstract class AbstractRequest implements Request, Serializable {
private static int nextId = 0;
protected transient Object response;
private final int id;
protected final Session session;
public AbstractRequest(final Session session) {
this.session = session;
id = nextId++;
}
public AbstractRequest(final ByteDecoder decoder) {
id = decoder.getInt();
session = (Session) decoder.getObject();
}
public final void encode(final ByteEncoder encoder) {
encoder.add(id);
encoder.add(session);
doEncode(encoder);
}
protected abstract void doEncode(ByteEncoder encoder);
public final void setResponse(final Object response) {
this.response = response;
}
public Object getResponse() {
return response;
}
public Session getSession() {
return session;
}
public int getId() {
return id;
}
}
// Copyright (c) Naked Objects Group Ltd.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy