java.lang.Object
org.freedesktop.dbus.StructHelper
Helper util to create
Struct
subclasses when receiving it from DBus.- Seit:
- v3.2.1 - 2019-10-25
- Autor:
- David M.
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic <T extends Struct>
voidconvertToStructCollection
(Collection<Object[]> _input, Class<T> _structType, Collection<T> _result) Creates a collection of struct of the given type using the list of object arrays.convertToStructList
(List<Object[]> _obj, Class<T> _structType) Creates aArrayList
of struct of the given type using the list of object arrays.convertToStructSet
(Set<Object[]> _obj, Class<T> _structType) Creates aLinkedHashSet
of struct of the given type using the list of object arrays.static <T extends Struct>
TcreateStruct
(Class<?>[] _constructorArgs, Object _values, Class<T> _classToConstruct) Will create a newStruct
subclass instance if possible.static <T extends Struct>
TcreateStructFromVariant
(Variant<?> _variant, Class<T> _structClass) Creates a instance of the givenStruct
subclass if the given variant is some sort of Struct.
-
Methodendetails
-
convertToStructList
public static <T extends Struct> List<T> convertToStructList(List<Object[]> _obj, Class<T> _structType) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException Creates aArrayList
of struct of the given type using the list of object arrays.- Typparameter:
T
- struct type- Parameter:
_obj
- list of object arrays to process_structType
- struct class to create- Gibt zurück:
- List of given struct type
- Löst aus:
NoSuchMethodException
- when no constructor can be found for the arguments of the structSecurityException
- when constructor cannot be accessesInstantiationException
- when reflection failsIllegalAccessException
- if this Constructor object is enforcing Java language access control and the underlying constructor is inaccessible.IllegalArgumentException
- when data types are incompatible or incompatible argument lengthInvocationTargetException
- if the underlying constructor throws an exception- Seit:
- 4.3.1 - 2023-08-16
-
convertToStructSet
public static <T extends Struct> Set<T> convertToStructSet(Set<Object[]> _obj, Class<T> _structType) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException Creates aLinkedHashSet
of struct of the given type using the list of object arrays.- Typparameter:
T
- struct type- Parameter:
_obj
- list of object arrays to process_structType
- struct class to create- Gibt zurück:
- List of given struct type
- Löst aus:
NoSuchMethodException
- when no constructor can be found for the arguments of the structSecurityException
- when constructor cannot be accessesInstantiationException
- when reflection failsIllegalAccessException
- if this Constructor object is enforcing Java language access control and the underlying constructor is inaccessible.IllegalArgumentException
- when data types are incompatible or incompatible argument lengthInvocationTargetException
- if the underlying constructor throws an exception- Seit:
- 4.3.1 - 2023-08-16
-
convertToStructCollection
public static <T extends Struct> void convertToStructCollection(Collection<Object[]> _input, Class<T> _structType, Collection<T> _result) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException Creates a collection of struct of the given type using the list of object arrays.- Typparameter:
T
- struct type- Parameter:
_input
- list of object arrays to process_structType
- struct class to create_result
- collection to store results- Löst aus:
NoSuchMethodException
- when no constructor can be found for the arguments of the structSecurityException
- when constructor cannot be accessesInstantiationException
- when reflection failsIllegalAccessException
- if this Constructor object is enforcing Java language access control and the underlying constructor is inaccessible.IllegalArgumentException
- when data types are incompatible or incompatible argument lengthInvocationTargetException
- if the underlying constructor throws an exception- Seit:
- 4.3.1 - 2023-08-16
-
createStructFromVariant
public static <T extends Struct> T createStructFromVariant(Variant<?> _variant, Class<T> _structClass) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException Creates a instance of the givenStruct
subclass if the given variant is some sort of Struct.- Typparameter:
T
- type of struct- Parameter:
_variant
- variant to convert_structClass
-Struct
subclass to create- Gibt zurück:
- instance of _structClass or null if _variant is not Struct compatible or any input parameter is null
- Löst aus:
NoSuchMethodException
- when no constructor can be found for the arguments of the structSecurityException
- when constructor cannot be accessesInstantiationException
- when reflection failsIllegalAccessException
- if this Constructor object is enforcing Java language access control and the underlying constructor is inaccessible.IllegalArgumentException
- when data types are incompatibleInvocationTargetException
- if the underlying constructor throws an exception
-
createStruct
public static <T extends Struct> T createStruct(Class<?>[] _constructorArgs, Object _values, Class<T> _classToConstruct) throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException Will create a newStruct
subclass instance if possible. May replace Wrapper-classes with primitive classes in _constructorArgs if constructor does not match.- Typparameter:
T
- type of struct- Parameter:
_constructorArgs
- argument-classes expected by constructor_values
- values passed to the constructor_classToConstruct
-Struct
subclass to instantiate- Gibt zurück:
- instance of _classToConstruct or null if any input argument is null
- Löst aus:
NoSuchMethodException
- when no constructor can be found for the arguments of the structSecurityException
- when constructor cannot be accessesInstantiationException
- when reflection failsIllegalAccessException
- if this Constructor object is enforcing Java language access control and the underlying constructor is inaccessible.IllegalArgumentException
- when data types are incompatibleInvocationTargetException
- if the underlying constructor throws an exception
-