Package net.dv8tion.jda.api.components
Class Components
java.lang.Object
net.dv8tion.jda.api.components.Components
Utility class for components.
This utility builds on ComponentDeserializer to deserialize components.
The implementation provided by ComponentDeserializer allows to deserialize components with implicit FileUploads like Thumbnail.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Component>
TparseComponent(Class<T> componentType, DataObject data) Converts the providedDataObjectinto a component of typeComponents.parseComponents(Class<T> componentType, DataArray data) static <T extends ComponentTree<?>>
TConverts the providedDataArrayinto aComponentTree.
-
Constructor Details
-
Components
public Components()
-
-
Method Details
-
parseComponent
@Nonnull public static <T extends Component> T parseComponent(@Nonnull Class<T> componentType, @Nonnull DataObject data) Converts the providedDataObjectinto a component of typeComponents.
Note that any unsupported component will be represented as anUnknownComponent.- Parameters:
data- TheDataArrayto create the component tree from- Returns:
- A
ComponentTreerepresenting the provided data - Throws:
IllegalArgumentException- If the provided data isnull, or the component is not of typeComponents- See Also:
-
parseComponents
@Nonnull public static <T extends Component> List<T> parseComponents(@Nonnull Class<T> componentType, @Nonnull DataArray data) Converts the providedDataArrayinto aListof components.
Note that any unsupported component will be represented as anUnknownComponent.- Parameters:
data- TheDataArrayto create the components from- Returns:
- A
ListofComponentsrepresenting the provided data - Throws:
IllegalArgumentException- If the provided data isnull, or one of the components is not of typeComponents- See Also:
-
parseTree
@Nonnull public static <T extends ComponentTree<?>> T parseTree(@Nonnull Class<T> treeType, @Nonnull DataArray data) Converts the providedDataArrayinto aComponentTree.
Note that any unsupported component will be represented as anUnknownComponent.- Parameters:
data- TheDataArrayto create the component tree from- Returns:
- A
ComponentTreerepresenting the provided data - Throws:
IllegalArgumentException- If the provided data isnull, or one of the components is not compatible.UnsupportedOperationException- If the provided tree type is not supported- See Also:
-