
nl.pvanassen.highchart.api.utils.JsonArray Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of highchart-java-api Show documentation
Show all versions of highchart-java-api Show documentation
A Java API to generate highchart json on the server side.
The newest version!
package nl.pvanassen.highchart.api.utils;
import java.util.ArrayList;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class JsonArray extends ArrayList {
private static final long serialVersionUID = 1L;
public E getItem(int index) {
return get(index);
}
public Integer getLength() {
return size();
}
public int length() {
return size();
}
public JsonArray pushElement(E value) {
pushItem(value);
return this;
}
public void pushItem(E value) {
add(value);
}
public JsonArray setElement(int index, E value) {
setItem(index, value);
return this;
}
public void setItem(int index, E value) {
if (size() > index) {
set(index, value);
}
else if (size() == index) {
add(index, value);
}
else {
while (size() < index) {
add(null);
}
add(index, value);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy