msgpack-java icon indicating copy to clipboard operation
msgpack-java copied to clipboard

nested custom type how to define and use custom template

Open shllove opened this issue 6 years ago • 1 comments

hi there, I have one custom type like: @Message public class TwoTuple<T1, T2> implements Serializable {

/**
 * serialVersionUID
 */
private static final long serialVersionUID = -9116740696855326636L;

private T1 first;

private T2 second;

public TwoTuple() {
	
}

public TwoTuple(T1 first, T2 second) {
    this.first = first;
    this.second = second;
}

public T1 getFirst() {
    return first;
}

public void setFirst(T1 first) {
    this.first = first;
}

public T2 getSecond() {
    return second;
}

public void setSecond(T2 second) {
    this.second = second;
}

@Override
public String toString() {
    return "TwoTuple{" +
            "first=" + first +
            ", second=" + second +
            '}';
}

}

and I want to use this custom type in this scene: @Message public class MyObject { public Map<String, List<TwoTuple<String, TwoTuple<String, List<String>>>>> formattedCascadeKeys; }

but I don't know how to define my own template and use it, i can't deserialize from byte[], any help would be appreciated, thanks.

shllove avatar Dec 14 '18 07:12 shllove

I use version 0.6.12

shllove avatar Dec 14 '18 07:12 shllove