我有课:
public class CounterBag<T extends Additive<T> & Cloneable & Serializable> {
private T cntData;
// c tor, accessors equals and hashcode...
public T getCounterData() {
return cntData;
}
}
other class Service
has a member of type Set<CounterBag>
.
Now inside the Service
I want to lookup for specific CounterBag
and return a clone of its cntData
member.
当在 service
类的搜索方法中我检测到集中的 CounterBag
实例,并尝试如下:
return counterBag.getCounterData().clone();
clone ()
似乎无法显示 。
我想知道需要做些什么才能使 < code> clone () 可见?