public void setEntity(Object entity, Type entityType) {
   this.originalEntity = this.entity = entity;
   this.entityType = entityType;
   if (this.entity instanceof GenericEntity) {
     final GenericEntity ge = (GenericEntity) this.entity;
     this.entity = ge.getEntity();
     this.entityType = ge.getType();
   }
 }
示例#2
0
  public void setEntity(Object entity) {
    if (entity == null) {
      this.entity = null;
      this.genericType = null;
      this.entityClass = null;
    } else if (entity instanceof GenericEntity) {

      GenericEntity ge = (GenericEntity) entity;
      this.entity = ge.getEntity();
      this.genericType = ge.getType();
      this.entityClass = ge.getRawType();
    } else {
      this.entity = entity;
      this.entityClass = entity.getClass();
      this.genericType = null;
    }
  }