public class GcPersistableHelper
extends java.lang.Object
Constructor and Description |
---|
GcPersistableHelper() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
columnName(java.lang.reflect.Field field)
Get the name of the column to store the field value in from the Persistable annotation or field name.
|
static java.util.List<java.lang.reflect.Field> |
compoundPrimaryKeyFields(java.lang.Class<? extends java.lang.Object> clazz)
Get the fields that have been specified as compound primary key fields.
|
static GcPersistableField |
findPersistableAnnotation(java.lang.reflect.Field field)
Find the Persistable annotation on the field, return null if there is not one.
|
static GcPersistableClass |
findPersistableClassAnnotation(java.lang.Class<? extends java.lang.Object> clazz)
Find the PersistableClass annotation on the class, or parent classes, return null if there is not one.
|
static boolean |
hasPersistableAnnotation(java.lang.Class<? extends java.lang.Object> clazz)
Whether the class has at least one Persistable(Field or Class) annnotation on the class itself or on any field.
|
static java.util.List<java.lang.reflect.Field> |
heirarchicalFields(java.lang.Class<?> clazz)
A list of heirachical fields from the entire object structure.
|
static boolean |
isCompoundPrimaryKey(java.lang.reflect.Field field)
Whether the field is a compound primary key, check Persistable annotation if there is one on the field, default false.
|
static boolean |
isPersist(java.lang.reflect.Field field,
java.lang.Class<?> clazz)
Whether the field should be persisted to the database, check Persistable field and class level annotations.
|
static boolean |
isPrimaryKey(java.lang.reflect.Field field)
Whether the field is a primary key, check Persistable annotation if there is one on the field, default false.
|
static boolean |
isSelect(java.lang.reflect.Field field,
java.lang.Class<?> clazz)
Whether the field should be selected from the database, check Persistable field and class level annotations.
|
static java.lang.String |
oracleStandardNameFromJava(java.lang.String javaName)
Get the oracle underscore name e.g.
|
static java.lang.reflect.Field |
primaryKeyField(java.lang.Class<? extends java.lang.Object> clazz)
Get the field that has been specified as the primary key - will return null if the class has compound column primary keys.
|
static boolean |
primaryKeyManuallyAssigned(java.lang.reflect.Field primaryKeyField)
Whether the primary key is manually assigned.
|
static java.lang.String |
primaryKeySequenceName(java.lang.reflect.Field primaryKeyField)
Get the sequence name for the primary key field.
|
static java.lang.String |
tableName(java.lang.Class<? extends java.lang.Object> clazz)
Get the name of the database table to store the object in from the Persistable annotation or the class name.
|
public static java.lang.String oracleStandardNameFromJava(java.lang.String javaName)
javaName
- is the java convention name.public static java.lang.String columnName(java.lang.reflect.Field field)
field
- is the field to get the name from.public static boolean isPrimaryKey(java.lang.reflect.Field field)
field
- is the field to check.public static boolean isCompoundPrimaryKey(java.lang.reflect.Field field)
field
- is the field to check.public static java.lang.String tableName(java.lang.Class<? extends java.lang.Object> clazz)
clazz
- is the field to check.public static boolean hasPersistableAnnotation(java.lang.Class<? extends java.lang.Object> clazz)
clazz
- is the field to check.public static java.util.List<java.lang.reflect.Field> heirarchicalFields(java.lang.Class<?> clazz)
clazz
- is the child class.public static boolean isSelect(java.lang.reflect.Field field, java.lang.Class<?> clazz)
field
- is the field to check.clazz
- is teh type of object we are checking.public static boolean isPersist(java.lang.reflect.Field field, java.lang.Class<?> clazz)
field
- is the field to check.clazz
- is teh type of object we are checking.public static GcPersistableClass findPersistableClassAnnotation(java.lang.Class<? extends java.lang.Object> clazz)
clazz
- is the class to find it on.public static GcPersistableField findPersistableAnnotation(java.lang.reflect.Field field)
field
- is the field to find it on.public static java.lang.reflect.Field primaryKeyField(java.lang.Class<? extends java.lang.Object> clazz)
clazz
- is the class to check for the field on.public static java.util.List<java.lang.reflect.Field> compoundPrimaryKeyFields(java.lang.Class<? extends java.lang.Object> clazz)
clazz
- is the class to check for the field on.public static java.lang.String primaryKeySequenceName(java.lang.reflect.Field primaryKeyField)
primaryKeyField
- is the field with the annotation for primary key and sequence on it.public static boolean primaryKeyManuallyAssigned(java.lang.reflect.Field primaryKeyField)
primaryKeyField
- is the field with the annotation for primary key and sequence on it.