package com.txtr.hibernatedelta.model;
import static javax.xml.bind.annotation.XmlAccessType.FIELD;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "database")
@XmlAccessorType(FIELD)
public class HibernateDatabase {
@XmlElementWrapper(name = "tables")
@XmlElement(name = "table")
private List<HibernateTable> tables = new ArrayList<HibernateTable>();
public List<HibernateTable> getTables() {
return tables;
}
public HibernateTable getTable(String name) {
for (HibernateTable table : tables) {
if (table.getName().equalsIgnoreCase(name)) {
return table;
}
}
throw new IllegalArgumentException("table not found: " + name);
}
}