package xyz.veronie.bgg.result; public class Thing { private int id; private ThingMetaData metaData; private ThingDetails details; private static String[] titles = { "Id", "Name" }; public Thing(int id, ThingMetaData metaData) { this.id = id; this.metaData = metaData; } public int getId() { return id; } public void setId(int id) { this.id = id; } public ThingMetaData getMetaData() { return metaData; } public void setMetaData(ThingMetaData metaData) { this.metaData = metaData; } public ThingDetails getDetails() { return details; } public void setDetails(ThingDetails details) { this.details = details; } public static String[] getTitles() { return titles; } /// get field at idx, order of titles public String getField(int idx) { if(idx >= titles.length) { } String returnStr; switch(idx) { case 0: returnStr = String.valueOf(this.id); break; case 1: returnStr = this.getMetaData().getName(); break; default: throw new ArrayIndexOutOfBoundsException( "idx " + String.valueOf(idx) + " must be in [0,1]"); } return returnStr; } }