congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
TableInfo.getDataClass
Code IndexAdd Tabnine to your IDE (free)

How to use
getDataClass
method
in
com.j256.ormlite.table.TableInfo

Best Java code snippets using com.j256.ormlite.table.TableInfo.getDataClass (Showing top 20 results out of 315)

origin: j256/ormlite-core

private MappedCreate(Dao<T, ID> dao, TableInfo<T, ID> tableInfo, String statement, FieldType[] argFieldTypes,
    String queryNextSequenceStmt, int versionFieldTypeIndex) {
  super(dao, tableInfo, statement, argFieldTypes);
  this.dataClassName = tableInfo.getDataClass().getSimpleName();
  this.queryNextSequenceStmt = queryNextSequenceStmt;
  this.versionFieldTypeIndex = versionFieldTypeIndex;
}
origin: com.j256.ormlite/ormlite-core

private MappedCreate(TableInfo<T, ID> tableInfo, String statement, FieldType[] argFieldTypes,
    String queryNextSequenceStmt, int versionFieldTypeIndex) {
  super(tableInfo, statement, argFieldTypes);
  this.dataClassName = tableInfo.getDataClass().getSimpleName();
  this.queryNextSequenceStmt = queryNextSequenceStmt;
  this.versionFieldTypeIndex = versionFieldTypeIndex;
}
origin: com.j256.ormlite/ormlite-core

protected BaseMappedStatement(TableInfo<T, ID> tableInfo, String statement, FieldType[] argFieldTypes) {
  this.tableInfo = tableInfo;
  this.clazz = tableInfo.getDataClass();
  this.idField = tableInfo.getIdField();
  this.statement = statement;
  this.argFieldTypes = argFieldTypes;
}
origin: j256/ormlite-core

/**
 * Match up our joined fields so we can throw a nice exception immediately if you can't join with this type.
 */
private void matchJoinedFieldsByName(JoinInfo joinInfo, String localColumnName, String joinedColumnName,
    QueryBuilder<?, ?> joinedQueryBuilder) throws SQLException {
  joinInfo.localField = tableInfo.getFieldTypeByColumnName(localColumnName);
  if (joinInfo.localField == null) {
    throw new SQLException("Could not find field in " + tableInfo.getDataClass() + " that has column-name '"
        + localColumnName + "'");
  }
  joinInfo.remoteField = joinedQueryBuilder.tableInfo.getFieldTypeByColumnName(joinedColumnName);
  if (joinInfo.remoteField == null) {
    throw new SQLException("Could not find field in " + joinedQueryBuilder.tableInfo.getDataClass()
        + " that has column-name '" + joinedColumnName + "'");
  }
}
origin: com.j256.ormlite/ormlite-core

/**
 * Match up our joined fields so we can throw a nice exception immediately if you can't join with this type.
 */
private void matchJoinedFieldsByName(JoinInfo joinInfo, String localColumnName, String joinedColumnName,
    QueryBuilder<?, ?> joinedQueryBuilder) throws SQLException {
  joinInfo.localField = tableInfo.getFieldTypeByColumnName(localColumnName);
  if (joinInfo.localField == null) {
    throw new SQLException("Could not find field in " + tableInfo.getDataClass() + " that has column-name '"
        + localColumnName + "'");
  }
  joinInfo.remoteField = joinedQueryBuilder.tableInfo.getFieldTypeByColumnName(joinedColumnName);
  if (joinInfo.remoteField == null) {
    throw new SQLException("Could not find field in " + joinedQueryBuilder.tableInfo.getDataClass()
        + " that has column-name '" + joinedColumnName + "'");
  }
}
origin: j256/ormlite-core

protected BaseMappedStatement(Dao<T, ID> dao, TableInfo<T, ID> tableInfo, String statement,
    FieldType[] argFieldTypes) {
  this.dao = dao;
  this.connectionSource = dao.getConnectionSource();
  this.tableInfo = tableInfo;
  this.clazz = tableInfo.getDataClass();
  this.idField = tableInfo.getIdField();
  this.statement = statement;
  this.argFieldTypes = argFieldTypes;
}
origin: com.j256.ormlite/ormlite-core

public static <T, ID> MappedDelete<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo)
    throws SQLException {
  FieldType idField = tableInfo.getIdField();
  if (idField == null) {
    throw new SQLException("Cannot delete from " + tableInfo.getDataClass()
        + " because it doesn't have an id field");
  }
  StringBuilder sb = new StringBuilder(64);
  appendTableName(databaseType, sb, "DELETE FROM ", tableInfo.getTableName());
  appendWhereFieldEq(databaseType, idField, sb, null);
  return new MappedDelete<T, ID>(tableInfo, sb.toString(), new FieldType[] { idField });
}
origin: com.j256.ormlite/ormlite-core

public static <T, ID> MappedUpdateId<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo)
    throws SQLException {
  FieldType idField = tableInfo.getIdField();
  if (idField == null) {
    throw new SQLException("Cannot update-id in " + tableInfo.getDataClass()
        + " because it doesn't have an id field");
  }
  StringBuilder sb = new StringBuilder(64);
  appendTableName(databaseType, sb, "UPDATE ", tableInfo.getTableName());
  sb.append("SET ");
  appendFieldColumnName(databaseType, sb, idField, null);
  sb.append("= ? ");
  appendWhereFieldEq(databaseType, idField, sb, null);
  return new MappedUpdateId<T, ID>(tableInfo, sb.toString(), new FieldType[] { idField, idField });
}
origin: j256/ormlite-core

/**
 * Delete all of the objects in the collection. This builds a {@link MappedDeleteCollection} on the fly because the
 * datas could be variable sized.
 */
public static <T, ID> int deleteObjects(Dao<T, ID> dao, TableInfo<T, ID> tableInfo,
    DatabaseConnection databaseConnection, Collection<T> datas, ObjectCache objectCache) throws SQLException {
  MappedDeleteCollection<T, ID> deleteCollection = MappedDeleteCollection.build(dao, tableInfo, datas.size());
  Object[] fieldObjects = new Object[datas.size()];
  FieldType idField = tableInfo.getIdField();
  int objC = 0;
  for (T data : datas) {
    fieldObjects[objC] = idField.extractJavaFieldToSqlArgValue(data);
    objC++;
  }
  return updateRows(databaseConnection, tableInfo.getDataClass(), deleteCollection, fieldObjects, objectCache);
}
origin: com.j256.ormlite/ormlite-core

/**
 * This is private because the execute is the only method that should be called here.
 */
private static <T, ID> MappedDeleteCollection<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo,
    int dataSize) throws SQLException {
  FieldType idField = tableInfo.getIdField();
  if (idField == null) {
    throw new SQLException("Cannot delete " + tableInfo.getDataClass()
        + " because it doesn't have an id field defined");
  }
  StringBuilder sb = new StringBuilder(128);
  appendTableName(databaseType, sb, "DELETE FROM ", tableInfo.getTableName());
  FieldType[] argFieldTypes = new FieldType[dataSize];
  appendWhereIds(databaseType, idField, sb, dataSize, argFieldTypes);
  return new MappedDeleteCollection<T, ID>(tableInfo, sb.toString(), argFieldTypes);
}
origin: j256/ormlite-core

/**
 * Delete all of the objects in the collection. This builds a {@link MappedDeleteCollection} on the fly because the
 * ids could be variable sized.
 */
public static <T, ID> int deleteIds(Dao<T, ID> dao, TableInfo<T, ID> tableInfo,
    DatabaseConnection databaseConnection, Collection<ID> ids, ObjectCache objectCache) throws SQLException {
  MappedDeleteCollection<T, ID> deleteCollection = MappedDeleteCollection.build(dao, tableInfo, ids.size());
  Object[] fieldObjects = new Object[ids.size()];
  FieldType idField = tableInfo.getIdField();
  int objC = 0;
  for (ID id : ids) {
    fieldObjects[objC] = idField.convertJavaFieldToSqlArgValue(id);
    objC++;
  }
  return updateRows(databaseConnection, tableInfo.getDataClass(), deleteCollection, fieldObjects, objectCache);
}
origin: com.j256.ormlite/ormlite-core

/**
 * Delete all of the objects in the collection. This builds a {@link MappedDeleteCollection} on the fly because the
 * datas could be variable sized.
 */
public static <T, ID> int deleteObjects(DatabaseType databaseType, TableInfo<T, ID> tableInfo,
    DatabaseConnection databaseConnection, Collection<T> datas, ObjectCache objectCache) throws SQLException {
  MappedDeleteCollection<T, ID> deleteCollection =
      MappedDeleteCollection.build(databaseType, tableInfo, datas.size());
  Object[] fieldObjects = new Object[datas.size()];
  FieldType idField = tableInfo.getIdField();
  int objC = 0;
  for (T data : datas) {
    fieldObjects[objC] = idField.extractJavaFieldToSqlArgValue(data);
    objC++;
  }
  return updateRows(databaseConnection, tableInfo.getDataClass(), deleteCollection, fieldObjects, objectCache);
}
origin: com.j256.ormlite/ormlite-core

public static <T, ID> MappedQueryForFieldEq<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo,
    FieldType idFieldType) throws SQLException {
  if (idFieldType == null) {
    idFieldType = tableInfo.getIdField();
    if (idFieldType == null) {
      throw new SQLException("Cannot query-for-id with " + tableInfo.getDataClass()
          + " because it doesn't have an id field");
    }
  }
  String statement = buildStatement(databaseType, tableInfo, idFieldType);
  return new MappedQueryForFieldEq<T, ID>(tableInfo, statement, new FieldType[] { idFieldType },
      tableInfo.getFieldTypes(), "query-for-id");
}
origin: j256/ormlite-core

public static <T, ID> MappedDelete<T, ID> build(Dao<T, ID> dao, TableInfo<T, ID> tableInfo) throws SQLException {
  FieldType idField = tableInfo.getIdField();
  if (idField == null) {
    throw new SQLException(
        "Cannot delete from " + tableInfo.getDataClass() + " because it doesn't have an id field");
  }
  StringBuilder sb = new StringBuilder(64);
  DatabaseType databaseType = dao.getConnectionSource().getDatabaseType();
  appendTableName(databaseType, sb, "DELETE FROM ", tableInfo.getTableName());
  appendWhereFieldEq(databaseType, idField, sb, null);
  return new MappedDelete<T, ID>(dao, tableInfo, sb.toString(), new FieldType[] { idField });
}
origin: j256/ormlite-core

public static <T, ID> MappedUpdateId<T, ID> build(Dao<T, ID> dao, TableInfo<T, ID> tableInfo) throws SQLException {
  FieldType idField = tableInfo.getIdField();
  if (idField == null) {
    throw new SQLException(
        "Cannot update-id in " + tableInfo.getDataClass() + " because it doesn't have an id field");
  }
  StringBuilder sb = new StringBuilder(64);
  DatabaseType databaseType = dao.getConnectionSource().getDatabaseType();
  appendTableName(databaseType, sb, "UPDATE ", tableInfo.getTableName());
  sb.append("SET ");
  appendFieldColumnName(databaseType, sb, idField, null);
  sb.append("= ? ");
  appendWhereFieldEq(databaseType, idField, sb, null);
  return new MappedUpdateId<T, ID>(dao, tableInfo, sb.toString(), new FieldType[] { idField, idField });
}
origin: com.j256.ormlite/ormlite-core

  public static <T, ID> MappedRefresh<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo)
      throws SQLException {
    FieldType idField = tableInfo.getIdField();
    if (idField == null) {
      throw new SQLException("Cannot refresh " + tableInfo.getDataClass()
          + " because it doesn't have an id field");
    }
    String statement = buildStatement(databaseType, tableInfo, idField);
    return new MappedRefresh<T, ID>(tableInfo, statement, new FieldType[] { tableInfo.getIdField() },
        tableInfo.getFieldTypes());
  }
}
origin: j256/ormlite-core

/**
 * This is private because the execute is the only method that should be called here.
 */
private static <T, ID> MappedDeleteCollection<T, ID> build(Dao<T, ID> dao, TableInfo<T, ID> tableInfo, int dataSize)
    throws SQLException {
  FieldType idField = tableInfo.getIdField();
  if (idField == null) {
    throw new SQLException(
        "Cannot delete " + tableInfo.getDataClass() + " because it doesn't have an id field defined");
  }
  StringBuilder sb = new StringBuilder(128);
  DatabaseType databaseType = dao.getConnectionSource().getDatabaseType();
  appendTableName(databaseType, sb, "DELETE FROM ", tableInfo.getTableName());
  FieldType[] argFieldTypes = new FieldType[dataSize];
  appendWhereIds(databaseType, idField, sb, dataSize, argFieldTypes);
  return new MappedDeleteCollection<T, ID>(dao, tableInfo, sb.toString(), argFieldTypes);
}
origin: j256/ormlite-core

public static <T, ID> MappedQueryForFieldEq<T, ID> build(Dao<T, ID> dao, TableInfo<T, ID> tableInfo,
    FieldType idFieldType) throws SQLException {
  if (idFieldType == null) {
    idFieldType = tableInfo.getIdField();
    if (idFieldType == null) {
      throw new SQLException("Cannot query-for-id with " + tableInfo.getDataClass()
          + " because it doesn't have an id field");
    }
  }
  DatabaseType databaseType = dao.getConnectionSource().getDatabaseType();
  String statement = buildStatement(databaseType, tableInfo, idFieldType);
  return new MappedQueryForFieldEq<T, ID>(dao, tableInfo, statement, new FieldType[] { idFieldType },
      tableInfo.getFieldTypes(), "query-for-id");
}
origin: j256/ormlite-core

  public static <T, ID> MappedRefresh<T, ID> build(Dao<T, ID> dao, TableInfo<T, ID> tableInfo) throws SQLException {
    FieldType idField = tableInfo.getIdField();
    if (idField == null) {
      throw new SQLException(
          "Cannot refresh " + tableInfo.getDataClass() + " because it doesn't have an id field");
    }
    DatabaseType databaseType = dao.getConnectionSource().getDatabaseType();
    String statement = buildStatement(databaseType, tableInfo, idField);
    return new MappedRefresh<T, ID>(dao, tableInfo, statement, new FieldType[] { tableInfo.getIdField() },
        tableInfo.getFieldTypes());
  }
}
origin: j256/ormlite-core

@Test
public void testBasic() throws SQLException {
  TableInfo<Foo, String> tableInfo = new TableInfo<Foo, String>(databaseType, Foo.class);
  assertEquals(Foo.class, tableInfo.getDataClass());
  assertEquals(TABLE_NAME, tableInfo.getTableName());
  assertEquals(COLUMN_NAME, tableInfo.getIdField().getColumnName());
  assertEquals(1, tableInfo.getFieldTypes().length);
  assertSame(tableInfo.getIdField(), tableInfo.getFieldTypes()[0]);
  assertEquals(COLUMN_NAME, tableInfo.getFieldTypeByColumnName(COLUMN_NAME).getColumnName());
}
com.j256.ormlite.tableTableInfogetDataClass

Javadoc

Return the class associated with this object-info.

Popular methods of TableInfo

  • <init>
  • getFieldTypes
    Return the array of field types associated with the object.
  • getTableName
    Return the name of the table associated with the object.
  • getIdField
    Return the id-field associated with the object.
  • getFieldTypeByColumnName
    Return the FieldType associated with the columnName.
  • objectToString
    Return a string representation of the object.
  • createObject
    Create and return an object of this type using our reflection constructor.
  • getForeignCollections
    Return an array with the fields that are ForeignCollections or a blank array if none.
  • hasColumnName
    Return true if this table information has a field with this columnName as set by DatabaseField#colum
  • isForeignAutoCreate
    Return true if one of the fields has DatabaseField#foreignAutoCreate() enabled.
  • isUpdatable
    Return true if we can update this object via its ID.
  • wireNewInstance
  • isUpdatable,
  • wireNewInstance

Popular in Java

  • Making http post requests using okhttp
  • addToBackStack (FragmentTransaction)
  • findViewById (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JFileChooser (javax.swing)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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