Package com.alvazan.orm.impl.meta.data

Examples of com.alvazan.orm.impl.meta.data.MetaClass


      throw new UnsupportedOperationException("not done here yet, need to validate constant type");

    DboColumnMeta metaFieldDbo = typeInfo.getColumnInfo();
    String colFamily = metaFieldDbo.getOwner().getColumnFamily();
    String columnName = metaFieldDbo.getColumnName();
    MetaClass metaClass = metaInfo.getMetaClass(colFamily);
    MetaField metaField = metaClass.getMetaFieldByCol(targetSubclass, columnName);
   
    Field field = metaField.getField();
    Class fieldType = field.getType();
    //Are actual type will never be a primitive because of autoboxing.  When the param
    //is passed in, it becomes an Long, Integer, etc. so we need to convert here
View Full Code Here


        log.debug("need read as isInsert="+isInsert);
      needRead = true;
    }
   
    Class cl = entity.getClass();
    MetaClass metaClass = metaInfo.getMetaClass(cl);
    if(metaClass == null)
      throw new IllegalArgumentException("Entity type="+entity.getClass().getName()+" was not scanned and added to meta information on startup.  It is either missing @NoSqlEntity annotation or it was not in list of scanned packages");
   
    putImpl(entity, needRead, metaClass);
  }
View Full Code Here

 
  @SuppressWarnings({ "rawtypes", "unchecked" })
  @Override
  public void put(Object entity) {
    Class cl = entity.getClass();
    MetaClass metaClass = metaInfo.getMetaClass(cl);
    if(metaClass == null)
      throw new IllegalArgumentException("Entity type="+entity.getClass().getName()+" was not scanned and added to meta information on startup.  It is either missing @NoSqlEntity annotation or it was not in list of scanned packages");

    boolean needRead = false;
    MetaIdField idField = metaClass.getIdField();
    Object id = metaClass.fetchId(entity);
    if(idField.isAutoGen() && id != null && !(entity instanceof NoSqlProxy)) {
      //We do NOT have the data from the database IF this is NOT a NoSqlProxy and we need it since this is an
      //update
      needRead = true;
    }
View Full Code Here

  }
 
  @SuppressWarnings({ "rawtypes", "unchecked" })
  @Override
  public void fillInWithKey(Object entity) {
    MetaClass metaClass = metaInfo.getMetaClass(entity.getClass());
    MetaIdField idField = metaClass.getIdField();
    if (idField != null)
      idField.fillInAndFetchId(entity);
  }
View Full Code Here

  }

  @SuppressWarnings({ "unchecked", "rawtypes" })
  @Override
  public void remove(Object entity) {
    MetaClass metaClass = metaInfo.getMetaClass(entity.getClass());
    if(metaClass == null)
      throw new IllegalArgumentException("Entity type="+entity.getClass().getName()+" was not scanned and added to meta information on startup.  It is either missing @NoSqlEntity annotation or it was not in list of scanned packages");

    Object proxy = entity;
    Object pk = metaClass.fetchId(entity);
    MetaIdField idField = metaClass.getIdField();
    byte[] rowKey = idField.convertIdToNonVirtKey(pk);
    byte[] virtKey = idField.formVirtRowKey(rowKey);
    DboTableMeta metaDbo = metaClass.getMetaDbo();
   
    if(!metaClass.hasIndexedField(entity)) {
      session.remove(metaDbo, virtKey);
      return;
    } else if(!(entity instanceof NoSqlProxy)) {
      //then we don't have the database information for indexes so we need to read from the database
      proxy = find(metaClass.getMetaClass(), pk);
    }
   
    List<IndexData> indexToRemove = metaClass.findIndexRemoves((NoSqlProxy)proxy, rowKey);
   
    //REMOVE EVERYTHING HERE, we are probably removing extra and could optimize this later
    for(IndexData ind : indexToRemove) {
      session.removeFromIndex(metaDbo, ind.getColumnFamilyName(), ind.getRowKeyBytes(), ind.getIndexColumn());
    }
View Full Code Here

      throw new UnsupportedOperationException("not done here yet, need to validate constant type");

    DboColumnMeta metaFieldDbo = typeInfo.getColumnInfo();
    String colFamily = metaFieldDbo.getOwner().getColumnFamily();
    String columnName = metaFieldDbo.getColumnName();
    MetaClass metaClass = metaInfo.getMetaClass(colFamily);
    MetaField metaField = metaClass.getMetaFieldByCol(targetSubclass, columnName);
   
    Field field = metaField.getField();
    Class fieldType = field.getType();
    //Are actual type will never be a primitive because of autoboxing.  When the param
    //is passed in, it becomes an Long, Integer, etc. so we need to convert here
View Full Code Here

  private MetaInfo metaInfo;
 
  @SuppressWarnings({ "unchecked" })
  @Override
  public Object getKey(Object entity) {
    MetaClass metaClass = getMetaClass(entity.getClass());
    return metaClass.fetchId(entity);
  }
View Full Code Here

    MetaClass metaClass = getMetaClass(entity.getClass());
    return metaClass.fetchId(entity);
  }

  private MetaClass getMetaClass(Class type) {
    MetaClass meta = metaInfo.getMetaClass(type);
    if(meta == null)
      throw new IllegalArgumentException("Meta information not found on class="+type.getSimpleName());
    return meta;
  }
View Full Code Here

    return meta;
  }
 
  @Override
  public boolean isManagedEntity(Class<?> type) {
    MetaClass metaClass = metaInfo.getMetaClass(type);
    return metaClass != null;
  }
View Full Code Here

    return metaClass != null;
  }
 
  @Override
  public String getKeyFieldName(Class<?> type) {
    MetaClass meta = getMetaClass(type);
    return meta.getIdField().getFieldName();
  }
View Full Code Here

TOP

Related Classes of com.alvazan.orm.impl.meta.data.MetaClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.