protected QName createCollectionQName(TypeClassInfo info, AegisType type) {
    String ns;

    if (type.isComplex()) {
      ns = type.getSchemaType().getNamespaceURI();
    } else {
      ns = tm.getMappingIdentifierURI();
    }
    if (WSDLConstants.NS_SCHEMA_XSD.equals(ns)) {
      ns = HTTP_CXF_APACHE_ORG_ARRAYS;
    }

    String first = type.getSchemaType().getLocalPart().substring(0, 1);
    String last = type.getSchemaType().getLocalPart().substring(1);
    String localName = "ArrayOf" + first.toUpperCase() + last;
    if (info.nonDefaultAttributes()) {
      localName += "-";
      if (info.getMinOccurs() >= 0) {
        localName += info.getMinOccurs();
      }
      localName += "-";
      if (info.getMaxOccurs() >= 0) {
        localName += info.getMaxOccurs();
      }
      if (info.isFlat()) {
        localName += "Flat";
      }
    }

    return new QName(ns, localName);
  }
  protected AegisType createUserType(TypeClassInfo info) {
    try {
      AegisType type = info.getAegisTypeClass().newInstance();

      QName name = info.getTypeName();
      if (name == null) {
        // We do not want to use the java.lang.whatever schema type.
        // If the @ annotation or XML file didn't specify a schema type,
        // but the natural type has a schema type mapping, we use that rather
        // than create nonsense.
        Class<?> typeClass = TypeUtil.getTypeRelatedClass(info.getType());
        if (typeClass.getPackage().getName().startsWith("java")) {
          name = tm.getTypeQName(typeClass);
        }
        // if it's still null, we'll take our lumps, but probably end up with
        // an invalid schema.
        if (name == null) {
          name = createQName(typeClass);
        }
      }

      type.setSchemaType(name);
      type.setTypeClass(info.getType());
      type.setTypeMapping(getTypeMapping());

      return type;
    } catch (InstantiationException e) {
      throw new DatabindingException(
          "Couldn't instantiate type classs " + info.getAegisTypeClass().getName(), e);
    } catch (IllegalAccessException e) {
      throw new DatabindingException(
          "Couldn't access type classs " + info.getAegisTypeClass().getName(), e);
    }
  }
  protected QName createMapQName(TypeClassInfo info, AegisType keyType, AegisType valueType) {
    String name =
        keyType.getSchemaType().getLocalPart() + '2' + valueType.getSchemaType().getLocalPart();

    Class<?> cls = TypeUtil.getTypeRelatedClass(info.getType());
    name += cls.getSimpleName();

    // TODO: Get namespace from XML?
    return new QName(tm.getMappingIdentifierURI(), name);
  }
  public AegisType createTypeForClass(TypeClassInfo info) {

    Class<?> javaClass = TypeUtil.getTypeRelatedClass(info.getType());
    AegisType result = null;
    boolean newType = true;
    if (info.getType() instanceof TypeVariable) {
      // it's the generic type
      result = getOrCreateGenericType(info);
    } else if (info.getAegisTypeClass() != null) {
      result = createUserType(info);
    } else if (isArray(javaClass)) {
      result = createArrayType(info);
    } else if (isMap(javaClass)) {
      result = createMapType(info);
    } else if (isHolder(javaClass)) {
      result = createHolderType(info);
    } else if (isCollection(javaClass)) {
      result = createCollectionType(info);
    } else if (isEnum(javaClass)) {
      result = createEnumType(info);
    } else if (javaClass.equals(byte[].class)) {
      result = getTypeMapping().getType(javaClass);
    } else {
      AegisType type = getTypeMapping().getType(info.getType());
      if (type == null
          || (info.getTypeName() != null && !type.getSchemaType().equals(info.getTypeName()))) {
        if (info.getTypeName() != null) {
          type = getTypeMapping().getType(info.getTypeName());
        }
        if (type == null) {
          type = getTypeMapping().getType(javaClass);
        }
        if (type == null) {
          type = createDefaultType(info);
        } else {
          newType = false;
        }
      } else {
        newType = false;
      }

      result = type;
    }

    if (newType && !getConfiguration().isDefaultNillable()) {
      result.setNillable(false);
    }

    return result;
  }