Package org.freedesktop.dbus
Class StructHelper
- java.lang.Object
-
- org.freedesktop.dbus.StructHelper
-
public final class StructHelper extends java.lang.ObjectHelper util to createStructsubclasses when receiving it from DBus.- Since:
- v3.2.1 - 2019-10-25
-
-
Constructor Summary
Constructors Modifier Constructor Description privateStructHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Struct>
TcreateStruct(java.lang.Class<?>[] _constructorArgs, java.lang.Object _values, java.lang.Class<T> _classToConstruct)Will create a newStructsubclass instance if possible.static <T extends Struct>
TcreateStructFromVariant(Variant<?> _variant, java.lang.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, java.lang.Class<T> _structClass) throws java.lang.NoSuchMethodException, java.lang.SecurityException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException
Creates a instance of the givenStructsubclass if the given variant is some sort of Struct.- Type Parameters:
T- type 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:
java.lang.NoSuchMethodException- when no constructor can be found for the arguments of the structjava.lang.SecurityException- when constructor cannot be accessesjava.lang.InstantiationException- when reflection failsjava.lang.IllegalAccessException- if this Constructor object is enforcing Java language access control and the underlying constructor is inaccessible.java.lang.IllegalArgumentException- when data types are incompatiblejava.lang.reflect.InvocationTargetException- if the underlying constructor throws an exception
-
createStruct
public static <T extends Struct> T createStruct(java.lang.Class<?>[] _constructorArgs, java.lang.Object _values, java.lang.Class<T> _classToConstruct) throws java.lang.NoSuchMethodException, java.lang.SecurityException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException
Will create a newStructsubclass instance if possible. May replace Wrapper-classes with primitive classes in _constructorArgs if constructor does not match.- Type Parameters:
T- type of struct- 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:
java.lang.NoSuchMethodException- when no constructor can be found for the arguments of the structjava.lang.SecurityException- when constructor cannot be accessesjava.lang.InstantiationException- when reflection failsjava.lang.IllegalAccessException- if this Constructor object is enforcing Java language access control and the underlying constructor is inaccessible.java.lang.IllegalArgumentException- when data types are incompatiblejava.lang.reflect.InvocationTargetException- if the underlying constructor throws an exception
-
-