Package org.broadleafcommerce.core.util
Class EntityIdentifierUtil
java.lang.Object
org.broadleafcommerce.core.util.EntityIdentifierUtil
Utility class that will search for the entity identifier property and/or property value
- Author:
- dcolgrove
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected FieldfindIdentifierField(Class<?> clazz) Determine the Reflection Field with the @id annotation (jakarta.persistence.Id) This assumes the @Id annotation will be on the propertygetIdentifierFieldName(Class<?> clazz) Determine the field name with the @id annotation (jakarta.persistence.Id)getIdentifierFieldName(Object entity) Determine the field name with the @id annotation (jakarta.persistence.Id)getIdentifierFieldValue(Object entity) Given the entity, finds the identifier property and returns the associated valuegetIdentifyFieldValue(Object entity, String primaryKeyFieldName) Given the entity and specific field name, returns the value of that field.
-
Field Details
-
LOG
protected static final org.apache.commons.logging.Log LOG
-
-
Constructor Details
-
EntityIdentifierUtil
public EntityIdentifierUtil()
-
-
Method Details
-
getIdentifierFieldName
Determine the field name with the @id annotation (jakarta.persistence.Id)- Parameters:
entity- Object reference of the entity/bean where the property is to be searched- Returns:
- String representing the field name or null if the entity does not have an @Id annotation
-
getIdentifierFieldName
Determine the field name with the @id annotation (jakarta.persistence.Id)- Parameters:
clazz- Class reference of the entity/bean where the property is to be searched- Returns:
- String representing the field name or null if the entity does not have an @Id annotation
-
getIdentifierFieldValue
Given the entity, finds the identifier property and returns the associated value- Parameters:
entity- Object reference of the entity/bean where the property is to be searched- Returns:
- a Serializable instance of the value
-
getIdentifyFieldValue
Given the entity and specific field name, returns the value of that field.- Parameters:
entity- Object reference of the entity/bean where the property is to be searchedprimaryKeyFieldName- the name of the field where the value will be taken- Returns:
- a Serializable instance of the value
-
findIdentifierField
Determine the Reflection Field with the @id annotation (jakarta.persistence.Id) This assumes the @Id annotation will be on the property- Parameters:
clazz- Object reference of the entity/bean where the property is to be searched- Returns:
- String representing the field name or null if the entity does not have an @Id annotation
-