org.nakedobjects.nos.remote.command.java.JavaValueData Maven / Gradle / Ivy
package org.nakedobjects.nos.remote.command.java;
import java.io.Serializable;
import org.nakedobjects.noa.util.ByteDecoder;
import org.nakedobjects.noa.util.ByteEncoder;
import org.nakedobjects.noa.util.Encodable;
import org.nakedobjects.nof.core.util.ToString;
import org.nakedobjects.nof.reflect.remote.data.ValueData;
public class JavaValueData implements ValueData, Encodable, Serializable {
private static final long serialVersionUID = 1L;
private String type;
private String encodedValue;
protected JavaValueData(final String type, final String encodedValue) {
this.type = type.equals(String.class.getName()) ? "s" : type;
this.encodedValue = encodedValue;
}
public JavaValueData(final ByteDecoder decoder) {
type = decoder.getString();
encodedValue = decoder.getString();
}
public void encode(ByteEncoder encoder) {
encoder.add(type);
encoder.add(encodedValue);
}
public String getEncodedValue() {
return encodedValue;
}
public String getType() {
return type.equals("s") ? String.class.getName() : type;
}
public String toString() {
ToString str = new ToString(this);
str.append("type", type);
str.append("value", encodedValue);
return str.toString();
}
}
// Copyright (c) Naked Objects Group Ltd.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy