|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fr.emn.reactiveinput.DeviceUtilities
Utility methods for creating your own device, and generic methods for accessing device's properties.
Constructor Summary | |
DeviceUtilities()
|
Method Summary | |
static boolean |
belongsTo(Device d,
DeviceFolder f)
REMOVE ? |
static void |
copyPropertyValues(Device source,
Device dest)
Dest must be the same class, or a subclass of source. |
static Device |
createNewInstance(java.lang.Class cl)
This method instanciates a device with its no-arg constructor. |
static Device |
createNewInstance(Device d)
This method re-instanciates a device with its no-arg constructor. |
static Device |
defaultCopy(Device d)
Default method for copying a device : calls createNewInstance(), setPrototype(), then copyPropertyValues(). |
static boolean |
defaultIsOpenable(Device d)
Default method for telling if a device can be open: returns false if one or several obligatory input slots are not valid (see In.isValid()). |
static DeviceFolder[] |
getFolders(Device prototype)
Returns all folders containing the given prototype. |
static java.lang.String |
getGenericPropertyValue(Device d,
java.lang.String name)
Returns the value of a property in its generic string form. |
static java.lang.String[] |
getProperties(Device d)
Returns the valid properties of the device, matching declared properties and implemented accessors. |
static java.util.Vector |
getPropertiesWithTypes(Device d)
Returns the valid properties of the device, matching declared properties and implemented accessors. |
static java.lang.Object |
getPropertyValue(Device d,
java.lang.String name)
rem : Primitive return values are automatically wrapped into objects. |
static Device |
getPrototype(Device device)
Returns the prototype from which this device has been created. |
static Slot |
getSlot(Device d,
java.lang.String name,
boolean inSlot,
boolean outSlot)
|
static void |
register(DeviceFolder f)
Register the folder f and all its subfolders, so that we can retreive all folders containing a given prototype. |
static boolean |
setPropertyValue(Device d,
java.lang.String name,
java.lang.Object value)
Sets the value of a property. |
static boolean |
setPropertyValue(Device d,
java.lang.String name,
java.lang.String genericValue)
Sets the value of a property with a generic String form. |
static boolean |
setPropertyValues(Device d,
java.lang.String[] names,
java.lang.String[] genericValues)
|
static void |
setPrototype(Device device,
Device prototype)
Call this method in your own device copy() method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DeviceUtilities()
Method Detail |
public static boolean belongsTo(Device d, DeviceFolder f)
public static void copyPropertyValues(Device source, Device dest)
public static Device createNewInstance(java.lang.Class cl)
public static Device createNewInstance(Device d)
public static Device defaultCopy(Device d)
public static boolean defaultIsOpenable(Device d)
public static DeviceFolder[] getFolders(Device prototype)
Returns only registered folders (see register() method).
public static java.lang.String getGenericPropertyValue(Device d, java.lang.String name)
public static java.lang.String[] getProperties(Device d)
public static java.util.Vector getPropertiesWithTypes(Device d)
The resulting Vector contains the names (String) and the types (Class) of the properties found.
public static java.lang.Object getPropertyValue(Device d, java.lang.String name)
public static Device getPrototype(Device device)
Returns the device itself if it already a prototype, or if its original prototype is unknown.
public static Slot getSlot(Device d, java.lang.String name, boolean inSlot, boolean outSlot)
public static void register(DeviceFolder f)
public static boolean setPropertyValue(Device d, java.lang.String name, java.lang.Object value)
Integer, Boolean and Float arguments are automatically wrapped into primitives.
public static boolean setPropertyValue(Device d, java.lang.String name, java.lang.String genericValue)
"120" (int)
"120.58" (float)
"abc" (String)
"true" (boolean)
"[120, 55, 28]" (int array)
"[[2, 50], [3, 20]]" (2-dimensions int array)
etc.
public static boolean setPropertyValues(Device d, java.lang.String[] names, java.lang.String[] genericValues)
public static void setPrototype(Device device, Device prototype)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |