Class Utilities
- java.lang.Object
-
- com.github.collinalpert.java2db.utilities.Utilities
-
public class Utilities extends java.lang.Object- Author:
- Collin Alpert
-
-
Constructor Summary
Constructors Constructor Description Utilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<TableNameColumn>getAllFields(java.lang.Class<? extends BaseEntity> instanceClass)Gets all the fields and the fields of foreign key objects in this entity.static java.util.List<java.lang.reflect.Field>getEntityFields(java.lang.Class<? extends BaseEntity> instanceClass)static java.util.List<java.lang.reflect.Field>getEntityFields(java.lang.Class<? extends BaseEntity> instanceClass, boolean includeForeignKeys)static java.util.List<java.lang.reflect.Field>getEntityFields(java.lang.Class<? extends BaseEntity> instanceClass, java.lang.Class<?> delimiter)static java.lang.StringgetTableName(java.lang.Class<?> type)Gets the database table name from theTableNameattribute on the class.static voidlog(java.lang.Object text)Prints messages to the query, while considering theDBConnection.LOG_QUERIESconstant.static voidlogf(java.lang.String text, java.lang.Object... params)Prints formatted messages to the query, while considering theDBConnection.LOG_QUERIESconstant.
-
-
-
Method Detail
-
getEntityFields
public static java.util.List<java.lang.reflect.Field> getEntityFields(java.lang.Class<? extends BaseEntity> instanceClass)
-
getEntityFields
public static java.util.List<java.lang.reflect.Field> getEntityFields(java.lang.Class<? extends BaseEntity> instanceClass, boolean includeForeignKeys)
-
getEntityFields
public static java.util.List<java.lang.reflect.Field> getEntityFields(java.lang.Class<? extends BaseEntity> instanceClass, java.lang.Class<?> delimiter)
-
getAllFields
public static java.util.List<TableNameColumn> getAllFields(java.lang.Class<? extends BaseEntity> instanceClass)
Gets all the fields and the fields of foreign key objects in this entity.- Parameters:
instanceClass- The class to get the fields from.- Returns:
- A list of columns including references to their table.
-
log
public static void log(java.lang.Object text)
Prints messages to the query, while considering theDBConnection.LOG_QUERIESconstant.- Parameters:
text- The message to print.
-
logf
public static void logf(java.lang.String text, java.lang.Object... params)Prints formatted messages to the query, while considering theDBConnection.LOG_QUERIESconstant.- Parameters:
text- The formatted text.params- The parameters to be inserted into the string.
-
getTableName
public static java.lang.String getTableName(java.lang.Class<?> type)
Gets the database table name from theTableNameattribute on the class. If there is no attribute, the class name in lower case characters is returned.- Parameters:
type- The entity to get the table name of.- Returns:
- The table name.
-
-