com.barchart.ondemand.api.responses.FuturesSpecifications Maven / Gradle / Ivy
package com.barchart.ondemand.api.responses;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
public class FuturesSpecifications extends ResponseBase {
@JsonProperty("results")
private final List results = new ArrayList();
public Collection all() {
if (isEmpty()) {
return new ArrayList();
}
return Collections.unmodifiableCollection(results);
}
public FuturesSpecification bySymbol(final String symbol) {
if (symbol == null) {
return null;
}
for (FuturesSpecification fh : all()) {
if (fh.getSymbol() != null && fh.getSymbol().equalsIgnoreCase(symbol)) {
return fh;
}
}
return null;
}
public Collection byExchange(final String exchange) {
if (exchange == null) {
return null;
}
final Collection res = new ArrayList();
if (isEmpty()) {
return res;
}
for (FuturesSpecification fh : all()) {
if (fh.getExchange() != null && fh.getExchange().equalsIgnoreCase(exchange)) {
res.add(fh);
}
}
return res;
}
}