@OVLInaccessible public interface OVLEnvironment
Java methods and constructors can be equipped with a prepend
OVLEnvironment
parameter.
This parameter is hidden in OVL. When the according method is invoked from inside OVL code, the OVL runtime
environment internally submits the OVLEnvironment
. This class allows to get information about
the invoking OVL environment and to get dynamic access to fields, accessories, methods and classes defined in OVL from Java.- Author:
- Dr. Peter Droste, Omix Visualization
-
Method Summary
Modifier and Type Method Description Accessory
getAccessory(Object object, String accessoryName)
This method dynamically reads the content of the object's accessory field.Accessory
getAccessory(String namespace, Object object, String accessoryName)
This method dynamically reads the content of the object's accessory field.Constructor
getConstructor(Object object, String ovlClassName, Class<?>... params)
This method returns the constructor of an OVL class.Constructor
getConstructor(String namespace, Object object, String ovlClassName, Class<?>... params)
This method returns the constructor of an OVL class.Field
getField(Object object, String fieldName)
This method returns the OVL field of an object.Field
getField(String namespace, Object object, String fieldName)
This method returns the OVL field of an object.Method
getMethod(Object object, String methodName, Class<?>... params)
This method returns the OVL method of an object.Method
getMethod(String namespace, Object object, String methodName, Class<?>... params)
This method returns the OVL method of an object.boolean
isNamespaceAvailable(String namespace, Object object)
Tests if a namespace is available in the network.String
namespace()
Returns the current namespace which is the namespace of the superior calling OVL method.void
setCustomProperty(Component item, String name, Object value)
Adds a custom property to the network item.void
setTmpCustomProperty(Component item, String name, Object value)
Adds a temporary custom property to the network item.UserRequest
userRequest()
Returns theUserRequest
interface used in OVL to implement messaging and user interaction.
-
Method Details
-
getAccessory
Accessory getAccessory(String namespace, Object object, String accessoryName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldExceptionThis method dynamically reads the content of the object's accessory field.- Parameters:
namespace
- The namespace the accessory field was defined in.object
- The object owning the accessory field. Must be an OVL extension.accessoryName
- The name of the accessory field.- Returns:
- A reference to the accessory.
- Throws:
IllegalArgumentException
- if object is not an OVL extension.IllegalAccessException
- if accessory is not accessible.NoSuchFieldException
- if accesssory fieldaccessoryName
does not exist inobject
.
-
getAccessory
Accessory getAccessory(Object object, String accessoryName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldExceptionThis method dynamically reads the content of the object's accessory field. Same asgetAccessory(namespace(), object, accessoryName)
.- Parameters:
object
- The object owning the accessory field. Must be an OVL extension.accessoryName
- The name of the accessory field.- Returns:
- A reference to the accessory.
- Throws:
IllegalArgumentException
- if object is not an OVL extension.IllegalAccessException
- if accessory is not accessible.NoSuchFieldException
- if accessory fieldaccessoryName
does not exist inobject
.
-
getField
Field getField(String namespace, Object object, String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldExceptionThis method returns the OVL field of an object.- Parameters:
namespace
- The namespace the field was defined in.object
- The object owning the field. Must be an OVL extension or instance of an OVL class.fieldName
- The name of the field.- Returns:
- A
Field
object allowing dynamic access to the OVL field. - Throws:
IllegalArgumentException
- if object is not an OVL extension or instance of an OVL class.IllegalAccessException
- if field is not accessible.NoSuchFieldException
- if fieldfieldName
does not exist inobject
.
-
getField
Field getField(Object object, String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldExceptionThis method returns the OVL field of an object. Same asgetField(namespace(), object, fieldName)
.- Parameters:
object
- The object owning the field. Must be an OVL extension or instance of an OVL class.fieldName
- The name of the field.- Returns:
- A
Field
object allowing dynamic access to the OVL field. - Throws:
IllegalArgumentException
- if object is not an OVL extension or instance of an OVL class.IllegalAccessException
- if field is not accessible.NoSuchFieldException
- if fieldfieldName
does not exist inobject
.
-
getMethod
Method getMethod(String namespace, Object object, String methodName, Class<?>... params) throws IllegalAccessException, IllegalArgumentException, NoSuchMethodExceptionThis method returns the OVL method of an object.- Parameters:
namespace
- The namespace the method was defined in.object
- The object owning the method. Must be an OVL extension or instance of an OVL class.methodName
- The name of the method.params
- parameter types of the method.- Returns:
- A
Method
object allowing dynamic access to the OVL method. - Throws:
IllegalAccessException
- if method is not accessible.IllegalArgumentException
- if object is not an OVL extension or instance of an OVL class.NoSuchMethodException
- if according method does not exist inobject
.
-
getMethod
Method getMethod(Object object, String methodName, Class<?>... params) throws IllegalAccessException, IllegalArgumentException, NoSuchMethodExceptionThis method returns the OVL method of an object. Same asgetMethod(namespace(), object, methodName, params)
.- Parameters:
object
- The object owning the method. Must be an OVL extension or instance of an OVL class.methodName
- The name of the method.params
- Parameter types of the method.- Returns:
- A
Method
object allowing dynamic access to the OVL method. - Throws:
IllegalAccessException
- if method is not accessible.IllegalArgumentException
- if object is not an OVL extension or instance of an OVL class.NoSuchMethodException
- if according method does not exist inobject
.
-
getConstructor
Constructor getConstructor(String namespace, Object object, String ovlClassName, Class<?>... params) throws IllegalAccessException, IllegalArgumentException, NoSuchMethodException, ClassNotFoundExceptionThis method returns the constructor of an OVL class.- Parameters:
namespace
- The namespace the method was defined in.object
- Any instance ofComponent
.ovlClassName
- The name of the OVL classparams
- Parameter types of the method.- Returns:
- A
Constructor
object allowing dynamic access to the OVL constructor. - Throws:
IllegalAccessException
- if constructor is not accessible.IllegalArgumentException
- if object is not instance ofComponent
.NoSuchMethodException
- if according constructor does not exist.ClassNotFoundException
- if according class does not exist
-
getConstructor
Constructor getConstructor(Object object, String ovlClassName, Class<?>... params) throws IllegalAccessException, IllegalArgumentException, NoSuchMethodException, ClassNotFoundExceptionThis method returns the constructor of an OVL class. Same asgetConstructor(namespace(), object, ovlClassName, params)
.- Parameters:
object
- Any instance ofComponent
.ovlClassName
- The name of the OVL classparams
- Parameter types of the method.- Returns:
- A
Constructor
object allowing dynamic access to the OVL constructor. - Throws:
IllegalAccessException
- if constructor is not accessible.IllegalArgumentException
- if object is not instance ofComponent
.NoSuchMethodException
- if according constructor does not exist.ClassNotFoundException
- if according class does not exist
-
isNamespaceAvailable
Tests if a namespace is available in the network. This is usually the case if the according plugin is activated in the document.- Parameters:
namespace
- to be testedobject
- Any instance ofComponent
.- Returns:
true
if namespace is available.- Throws:
IllegalArgumentException
- if object is not instance ofComponent
.
-
setCustomProperty
void setCustomProperty(Component item, String name, Object value) throws IllegalArgumentException, IllegalAccessExceptionAdds a custom property to the network item. By using this method setting custom properties is undoable.- Parameters:
item
-name
-value
-- Throws:
IllegalArgumentException
- if object is not instance ofComponent
.IllegalAccessException
- See Also:
Component.setCustomProperty(String, Object)
,Component.setTmpCustomProperty(String, Object)
,Component.getCustomProperty(String)
,Component.customPropertyNames()
-
setTmpCustomProperty
void setTmpCustomProperty(Component item, String name, Object value) throws IllegalArgumentException, IllegalAccessExceptionAdds a temporary custom property to the network item. By using this method setting custom properties is undoable.- Parameters:
item
-name
-value
-- Throws:
IllegalArgumentException
- if object is not instance ofComponent
.IllegalAccessException
- See Also:
Component.setCustomProperty(String, Object)
,Component.setTmpCustomProperty(String, Object)
,Component.getCustomProperty(String)
,Component.customPropertyNames()
-
userRequest
UserRequest userRequest()Returns theUserRequest
interface used in OVL to implement messaging and user interaction.- Returns:
- UserRequest
-
namespace
String namespace()Returns the current namespace which is the namespace of the superior calling OVL method.- Returns:
- namespace
-