Tabnine Logo
Column
Code IndexAdd Tabnine to your IDE (free)

How to use
Column
in
com.speedment.runtime.config

Best Java code snippets using com.speedment.runtime.config.Column (Showing top 20 results out of 315)

origin: speedment/speedment

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();
}
origin: speedment/speedment

/**
 * 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());
}
origin: speedment/speedment

.filter(t -> t.getId().equals(table.getId()))
.flatMap(Table::columns)
.filter(c -> c.getId().equals(column.getId()))
.filter(c -> c.getDatabaseType().equals(column.getDatabaseType()))
  c.mutator().setTypeMapper(typeMapperClass);
});
origin: speedment/speedment

public static boolean usesOptional(Column col) {
  return col.isNullable() 
    && HasNullable.ImplementAs.OPTIONAL
    == col.getNullableImplementation();
}

origin: speedment/speedment

/**
 * 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;
  }
}

origin: speedment/speedment

private String readFromResultSet(File file, Column c, AtomicInteger position) {
  final Dbms dbms = c.getParentOrThrow().getParentOrThrow().getParentOrThrow();
    dbmsTypeOf(dbmsHandlerComponent, c.getParentOrThrow().getParentOrThrow().getParentOrThrow()),
    c.findDatabaseType()
  );
  final boolean isCustomTypeMapper = c.getTypeMapper().isPresent()
    && !TypeMapper.identity().getClass().isAssignableFrom(typeMapperClass)
    && !TypeMapper.primitive().getClass().isAssignableFrom(typeMapperClass);
  if (c.isNullable() && !NULL_AWARE_GETTERS.contains(mapping.getJavaClass())) {
    file.add(Import.of(ResultSetUtil.class).static_().setStaticMember("*"));
      file.add(Import.of(SimpleType.create(c.getDatabaseType())));
      sb.append("(").append(shortName(c.getDatabaseType())).append(") ");
  } else {
    if (isCastingRequired(c, getterName)) {
      file.add(Import.of(SimpleType.create(c.getDatabaseType())));
      sb.append("(").append(shortName(c.getDatabaseType())).append(") ");
origin: speedment/speedment

    col.isNullable()
      ? optional(fuSupport.entityType())
      : fuSupport.entityType()
final String constant = getSupport().namer().javaStaticFieldName(col.getJavaName());
identifierEnum.add(EnumConstant.of(constant).add(Value.ofText(col.getId())));
      fuSupport.entityName() + "."
      + fuSupport.namer().javaStaticFieldName(
        fu.getForeignColumn().getJavaName()
if (col.getTypeMapper().isPresent()) {
  final String typeMapper = col.getTypeMapper().get();
intrf.add(Field.of(getSupport().namer().javaStaticFieldName(col.getJavaName()), ref.getType())
  .final_()
  .set(Value.ofInvocation(
origin: speedment/speedment

@Override
public String getDescription() {
  return "The referenced element " + col.getId()
    + ", is not enabled. Disabled elements will "
    + "not be generated. Thus, referencing a disabled element "
    + "will result in broken code.\n"
    + "This might be a result of the element in question not being enabled, "
    + "or that an ancestor of the element is not enabled. \n"
    + "To fix this issue, make sure the element " + targetName + " is enabled.";
}
origin: speedment/speedment

).toMap();
this.generatedFieldSupports = columnsByFields.entrySet().stream().filter(e -> e.getValue().isAutoIncrement())
.map(e -> new GeneratedFieldSupport<>(
  e.getKey(), e.getValue(),
  resultSetMapperComponent.apply(e.getValue().findDatabaseType())
)).collect(toList());
origin: speedment/speedment

column.mutator().setId(columnName);
column.mutator().setName(columnName);
column.mutator().setOrdinalPosition(md.getOrdinalPosition());
column.mutator().setNullable(nullable);
      + "Fallback to JDBC-type %s",
      table.getId(),
      column.getId(),
      md.getTypeName(),
      md.getDataType(),
column.mutator().setDatabaseType(selectedJdbcClass);
  ||  selectedJdbcClass == Character.class
  ||  selectedJdbcClass == Boolean.class) {
    column.mutator().setTypeMapper(TypeMapper.primitive().getClass());
  final Dbms dbms = schema.getParentOrThrow();
  final List<String> constants = enumConstantsOf(dbms, table, columnName);
  column.mutator().setEnumConstants(constants.stream().collect(joining(",")));
origin: speedment/speedment

/**
 * 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());
}
origin: speedment/speedment

@Override
public Type getJavaType(Column column) {
  return column.findDatabaseType();
}
origin: speedment/speedment

.filter(c -> c.getTypeMapper()
.filter(tm -> !"".equals(tm))
.filter(tm -> !tm.equals(TypeMapper.identity().getClass().getName()))
    .add(tmsName + " = " + SqlTypeMapperHelper.class.getSimpleName()
      + ".create(project, " + getSupport().entityName()
      + "." + getSupport().namer().javaStaticFieldName(col.getJavaName())
      + ", " + getSupport().entityName() + ".class);"
    );
origin: speedment/speedment

  column.getJavaName().replace("_", "")
))
    final Class<?>[] params = m.getParameterTypes();
    return params.length == 1 
      && params[0] == column.findDatabaseType();
  })
origin: speedment/speedment

col.isNullable() 
  ? DefaultType.optional(fuSupport.entityType()) 
  : fuSupport.entityType())
)))
.add(
  col.isNullable() ?
    "if (" + GETTER_METHOD_PREFIX + getSupport().namer().javaTypeName(col.getJavaName()) + "()" + isPresentName + ") " + block(
      "return foreignManager.stream().filter(" + fuSupport.entityName() + 
      "." + fuSupport.namer().javaStaticFieldName(fu.getForeignColumn().getJavaName()) + 
      ".equal(" + GETTER_METHOD_PREFIX + getSupport().namer().javaTypeName(col.getJavaName()) + 
      "()" + getterName + ")).findAny();"
    ) + " else " + block(
      "." + fuSupport.namer().javaStaticFieldName(fu.getForeignColumn().getJavaName()) + 
      ".equal(" + GETTER_METHOD_PREFIX + getSupport().namer().javaTypeName(col.getJavaName()) + 
      "()" + getterName + ")).findAny().orElse(null);"
origin: speedment/speedment

@Override
public Type getJavaType(Column column) {
  if (column.isNullable()) {
    return Boolean.class;
  } else {
    return boolean.class;
  }
}
origin: speedment/speedment

/**
 * Debug method used to track type mappers of a project. May be of future use if one perhaps would venture to
 * investigate why we get several copies of the dbms from the database
 */
private void printTypeMappers(String heading, Project p) {
  System.out.println(heading);
  p.dbmses().map(d -> (Dbms) d).forEach(dbms -> {
    dbms.schemas().map(s -> (Schema) s).forEach(schema -> {
      schema.tables().map(t -> (Table) t).forEach(table -> {
        table.columns().map(c -> (Column) c).filter(c -> c.getTypeMapper().isPresent()).forEach(column -> {
          String mapperName = column.getTypeMapper().get();
          if (mapperName.endsWith("PrimitiveTypeMapper")) {
            mapperName = "Primitive";
          }
          System.out.println(" - " + dbms.getName() + ":" + schema.getName() + "/" +
            table.getName() + "." + column.getName() + " mapped by " + mapperName);
        });
      });
    });
  });
}
origin: speedment/speedment

@Override
public Type getJavaType(Column column) {
  final String type = column.getDatabaseType();
  switch (type) {
    case "java.lang.Byte"      : return byte.class;
    case "java.lang.Short"     : return short.class;
    case "java.lang.Integer"   : return int.class;
    case "java.lang.Long"      : return long.class;
    case "java.lang.Float"     : return float.class;
    case "java.lang.Double"    : return double.class;
    case "java.lang.Boolean"   : return boolean.class;
    case "java.lang.Character" : return char.class;
    default : throw new UnsupportedOperationException(
      "Type " + type + " is not a wrapper for a primitive type."
    );
  }
}
origin: speedment/speedment

    .filter(col -> col.getAsString(ORIGINAL_TYPE).filter("INTEGER"::equalsIgnoreCase).isPresent())
    .noneMatch(col -> table.primaryKeyColumns().anyMatch(pkc -> DocumentDbUtil.isSame(pkc.findColumn().get(), col)))
  &&  table.columns().map(Column::getId).noneMatch("rowid"::equalsIgnoreCase)) {
    final Column column = table.mutator().addNewColumn();
    column.mutator().setId("rowid");
    column.mutator().setName("rowid");
    column.mutator().setOrdinalPosition(0);
    column.mutator().setDatabaseType(Long.class);
    column.mutator().setAutoIncrement(true);
    column.mutator().setNullable(false);
    column.mutator().setTypeMapper(PrimitiveTypeMapper.class);
  } else {
    table.columns()
      .filter(col -> col.getAsString(ORIGINAL_TYPE).filter("INTEGER"::equalsIgnoreCase).isPresent())
      .filter(col -> table.primaryKeyColumns().anyMatch(pkc -> DocumentDbUtil.isSame(pkc.findColumn().get(), col)))
      .forEach(col -> col.mutator().setAutoIncrement(true));
  col.getData().remove(ORIGINAL_TYPE);
});
origin: speedment/speedment

/**
 * 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;
}

com.speedment.runtime.configColumn

Javadoc

A typed Document that represents a column in the database. A Column is located inside a Table.

Most used methods

  • findDatabaseType
  • getId
  • getDatabaseType
  • getName
  • getParentOrThrow
  • getTypeMapper
  • isNullable
  • mutator
  • getJavaName
  • getEnumConstants
  • getNullableImplementation
  • isAutoIncrement
  • getNullableImplementation,
  • isAutoIncrement,
  • isEnabled,
  • getAlias,
  • getAsBoolean,
  • getAsString,
  • getColumnSize,
  • getData,
  • getDecimalDigits,
  • getOrdinalPosition

Popular in Java

  • Start an intent from android
  • addToBackStack (FragmentTransaction)
  • putExtra (Intent)
  • getExternalFilesDir (Context)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now