# getComponentType method

ResolvableType getComponentType()

Returns the component type of an array or list type.

For array/list types, this method returns a ResolvableType representing the type of elements contained in the array. For non-array types, this returns ResolvableType.NONE.

Returns:

- ResolvableType representing the component/element type
- ResolvableType.NONE if this is not an array type

Example:

    final stringListType = ResolvableType.forClass(List<String>);
    final intListType = ResolvableType.forClass(List<int>);
    final nestedListType = ResolvableType.forClass(List<List<String>>);

    final stringComponent = stringListType.getComponentType();
    print(stringComponent.resolve()?.getType()); // String

    final intComponent = intListType.getComponentType();
    print(intComponent.resolve()?.getType()); // int

    final nestedComponent = nestedListType.getComponentType();
    print(nestedComponent.resolve()?.getType()); // List<String>
    print(nestedComponent.isArray()); // true

    // Useful for recursive type processing
    void processArrayType(ResolvableType type) {
      if (type.isArray()) {
        final componentType = type.getComponentType();
        if (componentType.isArray()) {
          print("Multi-dimensional array");
          processArrayType(componentType); // Recursive processing
        } else {
          print("Array of ${componentType.resolve()?.getType()}");
        }
      }
    }

## Implementation

    ResolvableType getComponentType() {
      if (this == NONE) return NONE;

      if (_componentType != null) {
        return _componentType;
      }

      final resolved = resolve();

      if (resolved != null) {
        final componentClass = resolved.componentType();
        if (componentClass != null) {
          return forType(componentClass.getType(), this);
        }
      }

      return resolveType().getComponentType();
    }