小编Kar*_*ian的帖子

在谷歌地图中添加新标记之前删除上一个标记

我有以下代码在我点击地图的地方显示标记.它的工作完美,我想在添加新标记时删除以前的地图标记.在哪里我应该做出改变才能完美地工作.

       google.maps.event.addListener(map, "click", function (e) {

                    latLng = e.latLng;

                    console.log(e.latLng.lat());
                    console.log(e.latLng.lng());

                    image = clientURL + "/common/images/markers/red.png";
                    console.log("Marker");
                    marker = new google.maps.Marker({
                        position: latLng,
                        map: map,
                        icon: image
                    });


                });
Run Code Online (Sandbox Code Playgroud)

我提到了许多不适用于我的案例的链接要在添加新标记之前删除以前的标记

javascript google-maps google-maps-api-3

5
推荐指数
2
解决办法
1万
查看次数

使用Java POJO中的注释限制输入长度

我有一个像下面这样的 POJO 类,

    @XmlRootElement
    public class JsonReply {

@XmlElement(nillable = false)
String callResult;

@XmlElement(nillable=false)
String returnobj;

@NotNull
String callError;

public String getCallResult() {
    return callResult;
}

public void setCallResult(String callResult) {
    this.callResult = callResult;
}

public String getCallError() {
    return callError;
}

public void setCallError(String callError) {
    this.callError = callError;
}
Run Code Online (Sandbox Code Playgroud)

为了避免空字符串,我使用了许多注释,例如 Lombok 的 @NotNull 和 javax.xml.bind.annotation.XmlRootElement 的 @XmlElement(nillable=false)。我的问题是,是否有任何其他方式或注释来限制整数或字符串的长度,例如 min=5 和 max=10。

       @Size(max=10)
       @Max(5)
       Integer sampleint;
Run Code Online (Sandbox Code Playgroud)

我正在使用杰克逊。如果杰克逊本身有任何注释,比如@JsonIgnoreProperties,那就很好了。

谢谢!

java json web-services string-length annotated-pojos

0
推荐指数
1
解决办法
7803
查看次数