//GeoResult 类
public class GeoResult implements Serializable {
private static final long serialVersionUID = 1637452570977581370L;
private final T content; private final Distance distance;
public GeoResult(T content, Distance distance) {
Assert.notNull(content, "Content must not be null!");
Assert.notNull(distance, "Distance must not be null!");
this.content = content;
this.distance = distance;
}
}
//通过继承扩展GeoResult类
//通过继承扩展GeoResult类
public class GeoExtendResult extends GeoResult implements Serializable{
public GeoExtendResult(T content, Distance distance) {
super(content, distance);
}
}
//这是正确的
List>> geoResultList = radiusGeo.getContent();
//报类型不匹配
List>> geoResultList = radiusGeo.getContent();