com.github.drinkjava2.jsqlbox.entitynet
Class EntityIdUtils

java.lang.Object
  extended by com.github.drinkjava2.jsqlbox.entitynet.EntityIdUtils

public abstract class EntityIdUtils
extends Object

 Entity Id Utils, an Entity ID can be:
 
 1. A POJO Entity
 2. 
 3. Basic Java Objects (String, Integer, Long, Date, Boolean...)
 
 

Since:
1.0.0
Author:
Yong Zhu

Field Summary
static String COMPOUND_ID_SEPARATOR
          Used to combine compound key column values into a single String
 
Constructor Summary
EntityIdUtils()
           
 
Method Summary
static Object buildEntityIdFromEntity(Object entity, TableModel model)
           
static Object buildEntityIdFromMap(Map<String,Object> map, TableModel model)
           
static Object buildEntityIdFromOneRow(String[] titles, Object[] oneRow, TableModel model, String alias)
          Build entityId from titles, oneRow, model, alias
static Object buildEntityIdFromUnknow(Object entityId, TableModel model)
          Build Node id from unknown entityIdOrIdMap
static Object readFeidlValueFromEntityId(Object entityId, ColumnModel col)
          Read field value from entityId: 1) if entityId is map, get the value by use fieldName as key
2) if entityId is basic java Object, direct return it 3) if is Entity? read field value from it.
static
<T> T
setEntityIdValues(T bean, Object entityId, Collection<ColumnModel> cols)
          Put one id value into a entity bean, or put values according a map
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPOUND_ID_SEPARATOR

public static final String COMPOUND_ID_SEPARATOR
Used to combine compound key column values into a single String

See Also:
Constant Field Values
Constructor Detail

EntityIdUtils

public EntityIdUtils()
Method Detail

buildEntityIdFromOneRow

public static Object buildEntityIdFromOneRow(String[] titles,
                                             Object[] oneRow,
                                             TableModel model,
                                             String alias)
Build entityId from titles, oneRow, model, alias


buildEntityIdFromEntity

public static Object buildEntityIdFromEntity(Object entity,
                                             TableModel model)

buildEntityIdFromMap

public static Object buildEntityIdFromMap(Map<String,Object> map,
                                          TableModel model)

buildEntityIdFromUnknow

public static Object buildEntityIdFromUnknow(Object entityId,
                                             TableModel model)
Build Node id from unknown entityIdOrIdMap


setEntityIdValues

public static <T> T setEntityIdValues(T bean,
                                      Object entityId,
                                      Collection<ColumnModel> cols)
Put one id value into a entity bean, or put values according a map


readFeidlValueFromEntityId

public static Object readFeidlValueFromEntityId(Object entityId,
                                                ColumnModel col)
Read field value from entityId: 1) if entityId is map, get the value by use fieldName as key
2) if entityId is basic java Object, direct return it 3) if is Entity? read field value from it.



Copyright © 2018. All rights reserved.