/** * Returns {@code true} if the two specified documents represents the same * element in the database. Two documents are considered same if they have * the same name and type and their parents are considered same. * * @param first the first document * @param second the second document * @return {@code true} if same, else {@code false} */ public static boolean isSame(Column first, Column second) { if (first.getId().equals(second.getId())) { final Table firstParent = first.getParentOrThrow(); final Table secondParent = second.getParentOrThrow(); return isSame(firstParent, secondParent); } else { return false; } }
/** * 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()); }
final Table table = column.getParentOrThrow();
/** * Returns the full name of the enum that will be generated for * the specified column. * * @param column the column that should be implemented as an enum * @param injector the injector used in the platform * @return full name for the enum */ public static String enumNameOf(Column column, Injector injector) { final TranslatorSupport<Table> support = new TranslatorSupport<>(injector, column.getParentOrThrow()); final String shortName = support.namer().javaTypeName(column.getJavaName()); return support.generatedEntityType().getTypeName() + "." + shortName; }
private String readFromResultSet(File file, Column c, AtomicInteger position) { final Dbms dbms = c.getParentOrThrow().getParentOrThrow().getParentOrThrow(); dbmsTypeOf(dbmsHandlerComponent, c.getParentOrThrow().getParentOrThrow().getParentOrThrow()), c.findDatabaseType() );
/** * Returns the full name used in the database for the specified * {@link Column}. This is typically constructed by combining the table and * the column name with a separator, but that might be different in * different implementations. * * @param column the column to retrieve the name of * @return the full name */ default String fullNameOf(Column column) { final Table table = column.getParentOrThrow(); final Schema schema = table.getParentOrThrow(); return fullNameOf(schema.getName(), table.getName(), column.getName()); }
final String dbmsName = dbms.getName(); final String schemaName = ancestor(col, Schema.class).get().getName(); final String tableName = col.getParentOrThrow().getName(); final String columnName = col.getName();
private String readFromResultSet(File file, Column c, AtomicInteger position) { final Dbms dbms = c.getParentOrThrow().getParentOrThrow().getParentOrThrow(); dbmsTypeOf(dbmsHandlerComponent, c.getParentOrThrow().getParentOrThrow().getParentOrThrow()), c.findDatabaseType() );
/** * Returns the full name used in the database for the specified * {@link Column}. This is typically constructed by combining the table and * the column name with a separator, but that might be different in * different implementations. * * @param column the column to retrieve the name of * @return the full name */ default String fullNameOf(Column column) { final Table table = column.getParentOrThrow(); final Schema schema = table.getParentOrThrow(); return fullNameOf(schema.getName(), table.getName(), column.getName()); }