code: public static Class<? extends Storable> inferType(Class clazz) {
          if (clazz == null || !Storable.class.isAssignableFrom(clazz)) {
              return null;
          }
  
          if (clazz.isAnnotationPresent(PrimaryKey.class)) {
              return clazz;
          }
  
          Class candidate = inferType(clazz.getSuperclass());
  
          for (Class iface : clazz.getInterfaces()) {
              Class inferred = inferType(iface);
              if (inferred != null) {
                  if (candidate == null) {
                      candidate = inferred;
                  } else {
                      // Inference is ambiguous.
                      return null;
                  }
              }
          }
  
          return candidate;
      }
docs: Examines a class and determines what Storable type it implements. If it
  cannot be unambiguously inferred, null is returned. A non-null return
  value does not imply that the Storable type is valid, however. It must
  be {@link #examine examined} to check validity.
  
  @since 1.2