コード例 #1
0
  private <T> void findAndSetBaseClassViaMappings(
      ClassCacheMgr cacheMgr, CFMappingDef<T> cfMapDef) {
    CFMappingDef<? super T> cfBaseMapDef = cacheMgr.findBaseClassViaMappings(cfMapDef);

    if (null == cfBaseMapDef) {
      throw new HectorObjectMapperException(
          cfMapDef.getRealClass()
              + " is a derived class entity but @"
              + Table.class.getSimpleName()
              + " is not specified in its super classes - quitting");
    }

    cfMapDef.setCfBaseMapDef(cfBaseMapDef);
  }
コード例 #2
0
  private <T> void parseTableAnnotation(
      ClassCacheMgr cacheMgr, Table anno, CFMappingDef<T> cfMapDef) {
    CFMappingDef<?> tmpDef;

    // column family can only be mapped to one class (base class)
    if (null != (tmpDef = cacheMgr.getCfMapDef(anno.name(), false))) {
      throw new HectorObjectMapperException(
          "classes, "
              + cfMapDef.getEffectiveClass().getName()
              + " and "
              + tmpDef.getEffectiveClass().getName()
              + ", are both mapped to ColumnFamily, "
              + tmpDef.getEffectiveColFamName()
              + ".  Can only have one Class/ColumnFamily mapping - if multiple classes can be derived from a single ColumnFamily, use @"
              + Inheritance.class.getSimpleName());
    }
    cfMapDef.setColFamName(anno.name());
  }
コード例 #3
0
  private <T> void validateStandaloneClass(ClassCacheMgr cacheMgr, CFMappingDef<T> cfMapDef) {
    CFMappingDef<? super T> cfSuperDef;

    if (null == cfMapDef.getEffectiveColFamName()) {
      throw new HectorObjectMapperException(
          "Class, "
              + cfMapDef.getRealClass().getName()
              + ", is missing @"
              + Table.class.getSimpleName());
    } else if (null != (cfSuperDef = cacheMgr.findBaseClassViaMappings(cfMapDef))) {
      throw new HectorObjectMapperException(
          "@"
              + Table.class.getSimpleName()
              + " can only be used once per hierarchy and has been specified in class "
              + cfSuperDef.getRealClass().getName()
              + " and "
              + cfMapDef.getRealClass().getName()
              + " - quitting");
    }
  }