/** * Returns a list of all the enum constants in a particular column. * The list is created each time this method is called and is therefore * safe to edit without affecting the column. * <p> * If no enum constants was specified in the column, an exception is * thrown. * * @param column the column to retreive the constants from * @return list of the constants */ public static List<String> enumConstantsOf(Column column) { return Stream.of(column.getEnumConstants() .orElseThrow(() -> new RuntimeException( "Column '" + column.getId() + "' in table '" + column.getParentOrThrow().getId() + "' was marked as an enum but no enum constants was specified." )) .split(",") ).sorted().collect(toList()); }
ImmutableColumn(ImmutableTable parent, Map<String, Object> data) { super(parent, data); final Column prototype = new ColumnImpl(parent, data); this.enabled = prototype.isEnabled(); this.id = prototype.getId(); this.name = prototype.getName(); this.alias = prototype.getAlias(); this.nullable = prototype.isNullable(); this.nullableImplementation = prototype.getNullableImplementation(); this.autoincrement = prototype.isAutoIncrement(); this.typeMapper = prototype.getTypeMapper(); this.databaseType = prototype.getDatabaseType(); this.databaseTypeObject = prototype.findDatabaseType(); this.enumConstants = prototype.getEnumConstants(); this.decimalDigits = prototype.getDecimalDigits(); this.columnSize = prototype.getColumnSize(); this.ordinalPosition = prototype.getOrdinalPosition(); }