BorderType (final String name) { BorderType[] allTypes = getAllTypes(); for (BorderType type : allTypes) { if (type.getId().equals(name)) return type; } throw new UnexpectedFormElementException("unknown type: "+name); }