Package org.freedesktop.dbus
Class StructHelper
- java.lang.Object
-
- org.freedesktop.dbus.StructHelper
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Struct>
TcreateStruct(Class<?>[] _constructorArgs, Object _values, Class<T> _classToConstruct)Will create a newStructsubclass instance if possible.static <T extends Struct>
TcreateStructFromVariant(Variant<?> _variant, Class<T> _structClass)Creates a instance of the givenStructsubclass if the given variant is some sort of Struct.
-
-
-
Method Detail
-
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 givenStructsubclass if the given variant is some sort of Struct.- Parameters:
_variant- variant to convert_structClass-Structsubclass to create- Returns:
- instance of _structClass or null if _variant is not Struct compatible or any input parameter is null
- Throws:
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 newStructsubclass instance if possible. May replace Wrapper-classes with primitive classes in _constructorArgs if constructor does not match.- Parameters:
_constructorArgs- argument-classes expected by constructor_values- values passed to the constructor_classToConstruct-Structsubclass to instantiate- Returns:
- instance of _classToConstruct or null if any input argument is null
- Throws:
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
-
-