Package com.alvazan.orm.api.base.anno

Examples of com.alvazan.orm.api.base.anno.NoSqlConverter


    if (classMeta.getIdField() != null && (rowKey!=null)) {
      // first fill the id
      DboColumnEmbedMeta embedMeta = (DboColumnEmbedMeta) colMeta;
            Object idValue = null;
            MetaField<PROXY> metaFieldId = classMeta.getIdField();
            NoSqlConverter customConvId = metaFieldId.getField().getAnnotation(NoSqlConverter.class);
            byte[] idBytes = null;
            if (customConvId != null) {
                idValue = getValue(rowKey, customConvId);
                idBytes = getBytesValue(idValue, customConvId);
            } else {
                idValue = embedMeta.getFkToColumnFamily().getIdColumnMeta().getStorageType().convertFromNoSql(rowKey);
                idBytes = StandardConverters.convertToBytes(idValue);
            }
            if (metaFieldId != null)
                ReflectionUtil.putFieldValue(newproxy, metaFieldId.getField(),idValue);

      // Now extract other columns
      byte[] prefix = StandardConverters.convertToBytes(getColumnName());
      byte[] embedColumn = new byte[prefix.length + idBytes.length];
        System.arraycopy(prefix,0,embedColumn,0         ,prefix.length);
        System.arraycopy(idBytes,0,embedColumn,prefix.length,idBytes.length);
      Collection<Column> columnsInRow = row.columnByPrefix(embedColumn);
      for (Column colInRow : columnsInRow) {
        byte[] fullNameCol = colInRow.getName();
        int colLen = fullNameCol.length - embedColumn.length;
        byte[] fk = new byte[colLen];
        for (int i = embedColumn.length; i < fullNameCol.length; i++) {
          fk[i - embedColumn.length] = fullNameCol[i];
        }

                Object colVal = colMeta.convertFromStorage2(fk);
                String colName = colMeta.convertTypeToString(colVal);

                Object columnValue = null;
                MetaField<PROXY> metaField = classMeta.getMetaFieldByCol(null, colName);
                if(metaField == null)
                  continue; //skip this field sice we don't know this column
                NoSqlConverter customConv = metaField.getField().getAnnotation(NoSqlConverter.class);
                if (customConv != null) {
                    columnValue = getValue(colInRow.getValue(), customConv);
                } else {
                    columnValue = embedMeta.getFkToColumnFamily().getColumnMeta(colName).getStorageType().convertFromNoSql(colInRow.getValue());
                }
View Full Code Here


            DboColumnEmbedMeta embedMeta = (DboColumnEmbedMeta) colMeta;
            if (embedMeta.getFkToColumnFamily().getColumnMeta(columnName) == null)
                continue;
            Object columnValue = null;
            MetaField<PROXY> metaField = classMeta.getMetaFieldByCol(null, columnName);
            NoSqlConverter customConv = metaField.getField().getAnnotation(NoSqlConverter.class);
            if (customConv != null) {
                columnValue = getValue(col.getValue(), customConv);
            } else {
                columnValue = embedMeta.getFkToColumnFamily().getColumnMeta(columnName).getStorageType().convertFromNoSql(col.getValue());
            }
View Full Code Here

        columnName[i] = singleFieldName[i - prefix.length];
    }
    c.setName(columnName);
    if (value != null) {
            byte[] columnValue = null;
            NoSqlConverter customConv = singleField.getAnnotation(NoSqlConverter.class);
            if (customConv != null) {
                columnValue = getBytesValue(value, customConv);
            } else {
                columnValue = StandardConverters.convertToBytes(value);
            }
View Full Code Here

    metaField.setup(t, field, colName, converter, isIndexed, isPartitioned);
    return metaField;     
  }
 
  private Converter lookupConverter(Field field, Class<?> type, Converter custom) {
    NoSqlConverter customConv = field.getAnnotation(NoSqlConverter.class);
    if(customConv != null) {
      Class<? extends Converter> convClazz = customConv.converter();
      return ReflectionUtil.create(convClazz);
    } else if(custom != null) {
      return custom;
    } else if(customConverters.get(type) != null) {
      return customConverters.get(type);
View Full Code Here

TOP

Related Classes of com.alvazan.orm.api.base.anno.NoSqlConverter

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.