class JavassistFactory {

  public static ResolvedType typeUsageFor(CtClass ctClazz, TypeSolver typeSolver) {
    try {
      if (ctClazz.isArray()) {
        return new ResolvedArrayType(typeUsageFor(ctClazz.getComponentType(), typeSolver));
      }
          if (ctClazz.isPrimitive()) {
        if (ctClazz.getName().equals("void")) {
          return ResolvedVoidType.INSTANCE;
        }
        return ResolvedPrimitiveType.byName(ctClazz.getName());
      }
      if (ctClazz.isInterface()) {
          return new ReferenceTypeImpl(new JavassistInterfaceDeclaration(ctClazz, typeSolver));
        }
          if (ctClazz.isEnum()) {
          return new ReferenceTypeImpl(new JavassistEnumDeclaration(ctClazz, typeSolver));
        }
      return new ReferenceTypeImpl(new JavassistClassDeclaration(ctClazz, typeSolver));
    } catch (NotFoundException e) {
      throw new RuntimeException(e);
    }
  }

  public static ResolvedReferenceTypeDeclaration toTypeDeclaration(CtClass ctClazz, TypeSolver typeSolver) {<FILL_FUNCTION_BODY>}

  static AccessSpecifier modifiersToAccessLevel(final int modifiers) {
    if (Modifier.isPublic(modifiers)) {
      return AccessSpecifier.PUBLIC;
    }
      if (Modifier.isProtected(modifiers)) {
      return AccessSpecifier.PROTECTED;
    }
      if (Modifier.isPrivate(modifiers)) {
      return AccessSpecifier.PRIVATE;
    }
    return AccessSpecifier.NONE;
  }

}

    if (ctClazz.isAnnotation()) {
      return new JavassistAnnotationDeclaration(ctClazz, typeSolver);
    }
      if (ctClazz.isInterface()) {
      return new JavassistInterfaceDeclaration(ctClazz, typeSolver);
    }
      if (ctClazz.isEnum()) {
      return new JavassistEnumDeclaration(ctClazz, typeSolver);
    }
      if (ctClazz.isArray()) {
      throw new IllegalArgumentException("This method should not be called passing an array");
    }
    return new JavassistClassDeclaration(ctClazz, typeSolver);
  
<no_super_class>