public OpenFalconBean build(String metric, JSONObject valueJSON) {
        OpenFalconBean falconBean = initDefault(metric);
        falconBean.setValue((Number) valueJSON.get("value"));
        if (valueJSON.containsKey("title")) {
            String title = valueJSON.getString("title");
            if (title != null)
                falconBean.getTitles().addAll(new ArrayList<>(Arrays.asList(title.split(","))));
        }
        if (valueJSON.containsKey("dashboard")) {
            String dashboard = valueJSON.getString("dashboard");
            if (dashboard != null)
                falconBean.getDashboards().addAll(new ArrayList<>(Arrays.asList(dashboard.split(","))));
        }
        for (String tag : valueJSON.keySet()) {
            if ("value".equals(tag)) continue;
            //下面将每次重启都变掉的nodeId静态化
            if ("nodeId".equals(tag)) {
                falconBean.addTag("staticNodeId", StaticNodeIdManager.getStaticNodeId(valueJSON.getString("nodeId")));
//                falconBean.addTag(tag, valueJSON.get(tag));
            } else if ("application".equals(tag)) {
                LOG.debug("注意：不再加入application标签，静态staticFinalNodeId已经包含application信息了");
            } else if ("title".equals(tag)) {

            } else if ("dashboard".equals(tag)) {

            } else {
                falconBean.addTag(tag, valueJSON.get(tag));
            }
        }
        return falconBean;
    }
public OpenFalconBean build ( String metric , JSONObject valueJSON ) { OpenFalconBean falconBean = initDefault ( metric ) ; falconBean . setValue ( ( Number ) valueJSON . get ( "value" ) ) ; if ( valueJSON . containsKey ( "title" ) ) { String title = valueJSON . getString ( "title" ) ; if ( title != null ) falconBean . getTitles ( ) . addAll ( new ArrayList < > ( Arrays . asList ( title . split ( "," ) ) ) ) ; } if ( valueJSON . containsKey ( "dashboard" ) ) { String dashboard = valueJSON . getString ( "dashboard" ) ; if ( dashboard != null ) falconBean . getDashboards ( ) . addAll ( new ArrayList < > ( Arrays . asList ( dashboard . split ( "," ) ) ) ) ; } for ( String tag : valueJSON . keySet ( ) ) { if ( "value" . equals ( tag ) ) continue ; if ( "nodeId" . equals ( tag ) ) { falconBean . addTag ( "staticNodeId" , StaticNodeIdManager . getStaticNodeId ( valueJSON . getString ( "nodeId" ) ) ) ; } else if ( "application" . equals ( tag ) ) { LOG . debug ( "注意：不再加入application标签，静态staticFinalNodeId已经包含application信息了" ) ; } else if ( "title" . equals ( tag ) ) { } else if ( "dashboard" . equals ( tag ) ) { } else { falconBean . addTag ( tag , valueJSON . get ( tag ) ) ; } } return falconBean ; }
在日后变复杂后，可以考虑抽出来做成builder子类