public <T> void deleteByKeyAsync(T bean, Session session, ConsistencyLevel consistency) {
    ClassInformation classInformation = ClassInformations.INSTACE.getClass(bean.getClass());
    FieldInformation keyField = classInformation.getKeyInformation();

    deleteByKeyAsync(
        ReflectionUtil.INSTANCE.getMethod(bean, keyField.getField()),
        bean.getClass(),
        session,
        consistency);
  }
示例#2
0
 private <T> Object createObject(Class<T> bean, Row row, Map<String, Definition> mapDefinition) {
   Object newObjetc = ReflectionUtil.INSTANCE.newInstance(bean);
   ClassInformation classInformation = ClassInformations.INSTACE.getClass(bean);
   for (FieldInformation field : classInformation.getFields()) {
     if (field.isEmbedded()) {
       Object value = createObject(field.getField().getType(), row, mapDefinition);
       ReflectionUtil.INSTANCE.setMethod(newObjetc, field.getField(), value);
       continue;
     }
     ReturnValue returnValue = ReturnValues.INSTANCE.factory(field);
     Object value = returnValue.getObject(mapDefinition, field, row);
     ReflectionUtil.INSTANCE.setMethod(newObjetc, field.getField(), value);
   }
   return newObjetc;
 }