/** * Get the code for a given name. * * @param name the name. * @return the code. */ public static int getCode4Name(String name) { for (SpatialiteDatabaseType type : values()) { if (type.getTypeName().equals(name)) { return type.getCode(); } } throw new IllegalArgumentException("No such type known: " + name); }
/** * Get the type for a given code. * * @param code the code. * @return the data type. */ public static SpatialiteDatabaseType getType4Code(int code) { for (SpatialiteDatabaseType type : values()) { if (type.getCode() == code) { return type; } } throw new IllegalArgumentException("No such type known: " + code); }