public class EntityIdentifierUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.commons.logging.Log |
LOG |
| Constructor and Description |
|---|
EntityIdentifierUtil() |
| Modifier and Type | Method and Description |
|---|---|
protected Field |
findIdentifierField(Class<?> clazz)
Determine the Reflection Field with the @id annotation (javax.persistence.Id)
This assumes the @Id annotation will be on the property
|
String |
getIdentifierFieldName(Class<?> clazz)
Determine the field name with the @id annotation (javax.persistence.Id)
|
String |
getIdentifierFieldName(Object entity)
Determine the field name with the @id annotation (javax.persistence.Id)
|
Serializable |
getIdentifierFieldValue(Object entity)
Given the entity, finds the identifier property and returns the associated value
|
Serializable |
getIdentifyFieldValue(Object entity,
String primaryKeyFieldName)
Given the entity and specific field name, returns the value of that field.
|
public String getIdentifierFieldName(Object entity)
entity - Object reference of the entity/bean where the property is to be searchedpublic String getIdentifierFieldName(Class<?> clazz)
clazz - Class reference of the entity/bean where the property is to be searchedpublic Serializable getIdentifierFieldValue(Object entity)
entity - Object reference of the entity/bean where the property is to be searchedpublic Serializable getIdentifyFieldValue(Object entity, String primaryKeyFieldName)
entity - Object reference of the entity/bean where the property is to be searchedprimaryKeyFieldName - the name of the field where the value will be takenprotected Field findIdentifierField(Class<?> clazz)
entity - Object reference of the entity/bean where the property is to be searchedCopyright © 2021. All rights reserved.