Java tutorial
/* * Copyright 2013 Matt Bertolini * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.mattbertolini.statusboard.view.graph; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; import java.lang.*; import java.util.LinkedList; import java.util.List; /** * @author Matt Bertolini */ @JsonRootName("graph") @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonIgnoreProperties(ignoreUnknown = true) public class Graph { private String title; @JsonProperty("total") private Boolean totalShown; private GraphType type; private YAxis yAxis; private XAxis xAxis; private Error error; @JsonProperty(value = "refreshEveryNSeconds", required = false) private Integer refreshInterval; @JsonProperty("datasequences") private List<DataSequence> dataSequences; public Graph() { this.dataSequences = new LinkedList<DataSequence>(); } public String getTitle() { return this.title; } public void setTitle(String title) { this.title = title; } public Boolean isTotalShown() { return this.totalShown; } public void setTotalShown(Boolean totalShown) { this.totalShown = totalShown; } public GraphType getType() { return type; } public void setType(GraphType type) { this.type = type; } public YAxis getYAxis() { return yAxis; } public void setYAxis(YAxis yAxis) { this.yAxis = yAxis; } public XAxis getXAxis() { return xAxis; } public void setXAxis(XAxis xAxis) { this.xAxis = xAxis; } public Error getError() { return error; } public void setError(Error error) { this.error = error; } public Integer getRefreshInterval() { return refreshInterval; } /** * Set how often you want Status Board to poll the data in seconds. * * @param refreshInterval The refresh interval in seconds. */ public void setRefreshInterval(Integer refreshInterval) { this.refreshInterval = refreshInterval; } public List<DataSequence> getDataSequences() { return this.dataSequences; } public void addDataSequence(DataSequence dataSequence) { this.dataSequences.add(dataSequence); } public static Graph error(final String message, final String detailMessage) { Error error = new Error(message, detailMessage); Graph graph = new Graph(); graph.setError(error); return graph; } }