Top Description Inners Fields Constructors Methods
com.sun.star.lib.uno.helper

public Class PropertySet

extends ComponentBase
implements com.sun.star.beans.XPropertySet, com.sun.star.beans.XFastPropertySet, com.sun.star.beans.XMultiPropertySet
Class Inheritance
Imports
com.sun.star.uno.Type, .AnyConverter, .Any, .UnoRuntime, com.sun.star.lang.EventObject, com.sun.star.lang.WrappedTargetException, com.sun.star.uno.TypeClass, com.sun.star.uno.XInterface, com.sun.star.beans.XPropertyChangeListener, com.sun.star.beans.XVetoableChangeListener, com.sun.star.beans.PropertyChangeEvent, com.sun.star.beans.XPropertySet, com.sun.star.beans.Property, com.sun.star.beans.PropertyAttribute, com.sun.star.beans.UnknownPropertyException, com.sun.star.beans.XPropertiesChangeListener, com.sun.star.beans.XPropertySetInfo, com.sun.star.beans.XFastPropertySet, com.sun.star.beans.PropertyVetoException, com.sun.star.beans.XMultiPropertySet, java.util.Iterator, .Collection, .HashMap, java.lang.reflect.Field, com.sun.star.lang.DisposedException

This class is an implementation of the interfaces com.sun.star.beans.XPropertySet, com.sun.star.beans.XFastPropertySet and com.sun.star.beans.XMultiPropertySet. This class has to be inherited to be used. The values of properties are stored in member variables of the inheriting class. By overriding the methods convertPropertyValue, setPropertyValueNoBroadcast and getPropertyValue(Property) one can determine how property values are stored. When using the supplied implementations of this class then the member variables which hold property values have to be declared in the class which inherits last in the inheriting chain and they have to be public

Properties have to be registered by one of the registerProperty methods. They take among other arguments an Object named id which has to be a String that represents the name of the member variable. The registering has to occur in the constructor of the inheriting class. It is no allowed to add or change properties later on.

Example:

public class Foo extends PropertySet
{
    protected int intProp;

    public Foo()
    {
        registerProperty("PropertyA", 0, new Type(int.class), (short)0, "intProp");
    }
}

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private HashMap<Integer, com.sun.star.beans.Property>
private HashMap<String, com.sun.star.beans.Property>
private HashMap<com.sun.star.beans.Property, Object>
protected MultiTypeInterfaceContainer
private com.sun.star.beans.Property[]
protected MultiTypeInterfaceContainer
private int
protected com.sun.star.beans.XPropertySetInfo
Inherited from com.sun.star.lib.uno.helper.ComponentBase:
bDisposedbInDisposeEVT_LISTENER_TYPElistenerContainer

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addPropertiesChangeListener(String[] propNames, com.sun.star.beans.XPropertiesChangeListener listener)

public synchronized void
addPropertyChangeListener(String str, com.sun.star.beans.XPropertyChangeListener xPropertyChangeListener)

public synchronized void
addVetoableChangeListener(String str, com.sun.star.beans.XVetoableChangeListener xVetoableChangeListener)

protected void
assignPropertyId(com.sun.star.beans.Property
The Property object that is being assigned an id.
prop
,
Object
The object which identifies the storage used for the property's value.
id
)

Assigns an identifier object to a Property object so that the identifier can be obtained by getPropertyId later on.

private boolean
private Object
convert(Class<T> cl, Object obj)

protected boolean

Returns:

true - Conversion was successful. newVal contains a valid value for the property. false - conversion failed for some reason.
convertPropertyValue
(com.sun.star.beans.Property
- in-param property for which the data is to be converted.
property
,
Object[]
- out-param which contains the converted value on return.
newVal
,
Object[]
- out-param the current value of the property. It is used in calls to the XVetoableChangeListener and XPropertyChangeListener.
curVal
,
Object
- in-param. The value that is to be converted so that it matches Property and the internally used dataformat for that property.
setVal
)

Converts a value in a way so that it is appropriate for storing as a property value, that is setPropertyValueNoBroadcast can process the value without any further conversion.

protected void
fire(com.sun.star.beans.Property[]
Properties which will be or have been affected.
properties
,
Object[]
the new values of the properties.
newValues
,
Object[]
the old values of the properties.
oldValues
,
boolean
true means fire to VetoableChangeListener, false means fire to XPropertyChangedListener and XMultiPropertyChangedListener.
bVetoable
)

This method fires events to XPropertyChangeListener,XVetoableChangeListener and XPropertiesChangeListener event sinks.

public void
firePropertiesChangeEvent(String[] propNames, com.sun.star.beans.XPropertiesChangeListener listener)

public Object
getFastPropertyValue(int nHandle)

protected com.sun.star.beans.Property[]

Returns:

Array of all Property objects.
getProperties
()

Returns an array of all Property objects or an array of length null if there are no properties.

protected com.sun.star.beans.Property

Returns:

The Property object with the name propertyName.
getProperty
(String
The name of the property (Property.Name)
propertyName
)

Returns the Property object for a given property name or null if that property does not exists (i.e. it has not been registered).

protected com.sun.star.beans.Property

Returns:

The Property object with the handle nHandle
getPropertyByHandle
(int
The handle of the property (Property.Handle).
nHandle
)

Returns the Property object with a handle (Property.Handle) as specified by the argument nHandle.

protected Object

Returns:

The id object that identifies the storage used for the property's value.
getPropertyId
(com.sun.star.beans.Property
The property for which the id is to be retrieved.
prop
)

Returns the identifier object for a certain Property.

public synchronized com.sun.star.beans.XPropertySetInfo
public Object
protected Object

Returns:

The value of the property.
getPropertyValue
(com.sun.star.beans.Property
The property for which the value is to be retrieved.
property
)

Retrieves the value of a property.

public Object[]
getPropertyValues(String[] propNames)

If a value for a property could not be retrieved then the respective element in the returned array has the value null.

protected void
initMappings()

Initializes data structures used for mappings of property names to property object, property handles to property objects and property objects to id objects.

protected void
postDisposing()

Overrides com.sun.star.lib.uno.helper.ComponentBase.postDisposing.

Makes sure that listeners which are kept in aBoundLC (XPropertyChangeListener) and aVetoableLC (XVetoableChangeListener) receive a disposing call.

protected void
putProperty(com.sun.star.beans.Property
The Property object that is to be stored.
prop
)

Stores a Property object so that it can be retrieved subsequently by getProperty(String),getProperties(),getPropertyByHandle(int).

protected void
registerProperty(com.sun.star.beans.Property
The property to be registered.
prop
,
Object
Identifies the properties storage.
id
)

Registers a property with this helper class and associates the argument id with it.

protected void
registerProperty(String
The property's name (Property.Name).
name
,
int
The property's handle (Property.Handle).
handle
,
Type
The property's type (Property.Type).
type
,
short
The property's attributes (Property.Attributes).
attributes
,
Object
Identifies the property's storage.
id
)

Registers a property with this helper class and associates the argument id with it.

protected void
registerProperty(String
The property's name (Property.Name).
name
,
Type
The property's type (Property.Type).
type
,
short
The property's attributes (Property.Attributes).
attributes
,
Object
Identifies the property's storage.
id
)

Registers a property with this class and associates the argument id with it.

protected void
registerProperty(String
The name of the property.
propertyName
,
String
The name of the member variable that holds the value of the property.
memberName
,
short
The property attributes.
attributes
)

Registers a property with this class.

protected void
registerProperty(String
The name of the property and the member variable that holds the property's value.
propertyName
,
short
The property attributes.
attributes
)

Registers a property with this class.

public void
removePropertiesChangeListener(com.sun.star.beans.XPropertiesChangeListener xPropertiesChangeListener)

public synchronized void
removePropertyChangeListener(String propName, com.sun.star.beans.XPropertyChangeListener listener)

public synchronized void
removeVetoableChangeListener(String propName, com.sun.star.beans.XVetoableChangeListener listener)

public void
setFastPropertyValue(int nHandle, Object aValue)

public void
setPropertyValue(String
The name of the property.
name
,
Object
The new value of the property.
value
)

Sets the value of a property.

protected void
setPropertyValue(com.sun.star.beans.Property
The property whose value is to be set.
prop
,
Object
The new value for the property.
value
)

Sets the value of a property.

protected void
setPropertyValueNoBroadcast(com.sun.star.beans.Property
the property for which the new value is set
property
,
Object
the new value for the property.
newVal
)

Sets the value of a property.

public void
setPropertyValues(String[] propNames, Object[] values)

If the array of property names contains an unknown property then it will be ignored.

Inherited from com.sun.star.lib.uno.helper.ComponentBase:
addEventListenerdisposefinalizepreDisposingremoveEventListener

Field Detail

_handleToPropertyMapback to summary
private HashMap<Integer, com.sun.star.beans.Property> _handleToPropertyMap
_nameToPropertyMapback to summary
private HashMap<String, com.sun.star.beans.Property> _nameToPropertyMap
_propertyToIdMapback to summary
private HashMap<com.sun.star.beans.Property, Object> _propertyToIdMap
aBoundLCback to summary
protected MultiTypeInterfaceContainer aBoundLC
arPropertiesback to summary
private com.sun.star.beans.Property[] arProperties
aVetoableLCback to summary
protected MultiTypeInterfaceContainer aVetoableLC
lastHandleback to summary
private int lastHandle
propertySetInfoback to summary
protected com.sun.star.beans.XPropertySetInfo propertySetInfo

Constructor Detail

PropertySetback to summary
public PropertySet()

Method Detail

addPropertiesChangeListenerback to summary
public void addPropertiesChangeListener(String[] propNames, com.sun.star.beans.XPropertiesChangeListener listener)
addPropertyChangeListenerback to summary
public synchronized void addPropertyChangeListener(String str, com.sun.star.beans.XPropertyChangeListener xPropertyChangeListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException
addVetoableChangeListenerback to summary
public synchronized void addVetoableChangeListener(String str, com.sun.star.beans.XVetoableChangeListener xVetoableChangeListener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException
assignPropertyIdback to summary
protected void assignPropertyId(com.sun.star.beans.Property prop, Object id)

Assigns an identifier object to a Property object so that the identifier can be obtained by getPropertyId later on. The identifier is used to specify a certain storage for the property's value. If you do not override setPropertyValueNoBroadcast or getPropertyValue(Property) then the argument id has to be a String that equals the name of the member variable that holds the Property's value. Override this method if you want to implement your own mapping from Property objects to ids or if you need ids of a type other than String. Then you also need to override initMappings and getPropertyId.

Parameters
prop:com.sun.star.beans.Property

The Property object that is being assigned an id.

id:Object

The object which identifies the storage used for the property's value.

See Also
registerProperty(Property, Object)
checkTypeback to summary
private boolean checkType(Object obj)
convertback to summary
private Object convert(Class<T> cl, Object obj) throws com.sun.star.lang.IllegalArgumentException
convertPropertyValueback to summary
protected boolean convertPropertyValue(com.sun.star.beans.Property property, Object[] newVal, Object[] curVal, Object setVal) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException, com.sun.star.beans.UnknownPropertyException

Converts a value in a way so that it is appropriate for storing as a property value, that is setPropertyValueNoBroadcast can process the value without any further conversion. This implementation presumes that the values are stored in member variables of the furthest inheriting class. For example, class A inherits this class then members of class A can hold property values. If there is a class B which inherits A then only members of B can hold property values. The variables must be public. A property must have been registered (e.g. by registerProperty(Property, Object) in order for this method to work. The identifier argument (type Object) used in the registerProperty methods must be a String, which is, the name of the member variable that holds the property value. If one opts to store values differently then one may override this method, as well as setPropertyValueNoBroadcast and getPropertyValue(Property). This method is always called as a result of a call to one of the setter methods, such as XPropertySet.setPropertyValue, XFastPropertySet.setFastPropertyValue and XMultiPropertySet.setPropertyValues. If this method fails, that is, it returns false or throws an exception, then no listeners are notified and the property value, that was intended to be changed, remains untouched. This method does not have to deal with property attributes, such as PropertyAttribute.READONLY or PropertyAttribute.MAYBEVOID. The processing of these attributes occurs in the calling methods. Only if this method returns successfully further processing, such as listener notification and finally the modification of the property's value, will occur. The actual modification of a property's value is done by setPropertyValueNoBroadcast which is called subsequent to convertPropertyValue.

This method converts values by help of the com.sun.star.uno.AnyConverter which only does a few widening conversions on integer types and floating point types. For example, there is the property PropA with a Type equivalent to int.class and the value of the property is to be stored in a member variable of type int with name intProp. Then setPropertyValue is called:

  set.setPropertyValue( "PropA", Byte.valueOf( (byte)111));
  
At some point setPropertyValue will call convertPropertyValue and pass in the Byte object. Since we allow that Byte values can be used with the property and know that the value is to be stored in intProp (type int) we convert the Byte object into an Integer object which is then returned in the out-parameter newVal. This conversion is actually performed by the AnyConverter. Later the setPropertyValueNoBroadcast is called with that Integer object and the int value can be easily extracted from the object and be assigned to the member intProp.

The method handles Any arguments the same as Object arguments. That is, the setVal argument can be a java.lang.Boolean or a com.sun.star.uno.Any containing a java.lang.Boolean. Likewise, a member containing a property value can be a com.sun.star.uno.Any or a java.lang.Object. Then, no conversion is necessary, since they can hold all possible values. However, if the member is an Object and setVal is an Any then the object contained in the any is assigned to the member. The extra type information which exists as Type object in the Any will get lost. If this is not intended then use an Any variable rather than an Object. If a member is an Object or Any and the argument setVal is an Object, other than String or array, then it is presumed to be a UNO object and queried for XInterface. If successful, the out-param newVal returns the XInterface. If a member is a UNO interface, then setVal is queried for this interface and the result is returned. If setVal is null then newVal will be null too after return.

If a property value is stored using a primitive type the out-parameters curVal and newVal contain the respective wrapper class (e.g.java.lang.Byte, etc.). curVal is used in calls to the XVetoableChangeListener and XPropertyChangeListener.

Parameters
property:com.sun.star.beans.Property

- in-param property for which the data is to be converted.

newVal:Object[]

- out-param which contains the converted value on return.

curVal:Object[]

- out-param the current value of the property. It is used in calls to the XVetoableChangeListener and XPropertyChangeListener.

setVal:Object

- in-param. The value that is to be converted so that it matches Property and the internally used dataformat for that property.

Returns:boolean

true - Conversion was successful. newVal contains a valid value for the property. false - conversion failed for some reason.

Exceptions
IllegalArgumentException:
The value provided is unfit for the property.
WrappedTargetException:
- An exception occurred during the conversion, that is to be made known to the caller.
UnknownPropertyException:
See com.sun.star.beans.XPropertySet
fireback to summary
protected void fire(com.sun.star.beans.Property[] properties, Object[] newValues, Object[] oldValues, boolean bVetoable) throws com.sun.star.beans.PropertyVetoException

This method fires events to XPropertyChangeListener,XVetoableChangeListener and XPropertiesChangeListener event sinks. To distinguish what listeners are to be called the argument bVetoable is to be set to true if a XVetoableChangeListener is meant. For XPropertyChangeListener and XPropertiesChangeListener it is to be set to false.

Parameters
properties:com.sun.star.beans.Property[]

Properties which will be or have been affected.

newValues:Object[]

the new values of the properties.

oldValues:Object[]

the old values of the properties.

bVetoable:boolean

true means fire to VetoableChangeListener, false means fire to XPropertyChangedListener and XMultiPropertyChangedListener.

Exceptions
PropertyVetoException:
if a vetoable listener throws it.
firePropertiesChangeEventback to summary
public void firePropertiesChangeEvent(String[] propNames, com.sun.star.beans.XPropertiesChangeListener listener)
getFastPropertyValueback to summary
public Object getFastPropertyValue(int nHandle) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException
getPropertiesback to summary
protected com.sun.star.beans.Property[] getProperties()

Returns an array of all Property objects or an array of length null if there are no properties. Override this method if you want to implement your own mapping from names to Property objects. Then you also have to override initMappings, getProperty(String) and putProperty.

Returns:com.sun.star.beans.Property[]

Array of all Property objects.

getPropertyback to summary
protected com.sun.star.beans.Property getProperty(String propertyName)

Returns the Property object for a given property name or null if that property does not exists (i.e. it has not been registered). Override this method if you want to implement your own mapping from property names to Property objects. Then you also have to override initMappings, getProperties() and putProperty(Property).

Parameters
propertyName:String

The name of the property (Property.Name)

Returns:com.sun.star.beans.Property

The Property object with the name propertyName.

getPropertyByHandleback to summary
protected com.sun.star.beans.Property getPropertyByHandle(int nHandle)

Returns the Property object with a handle (Property.Handle) as specified by the argument nHandle. The method returns null if there is no such property (i.e. it has not been registered). Override this method if you want to implement your own mapping from handles to Property objects. Then you also have to override initMappings, putProperty(Property).

Parameters
nHandle:int

The handle of the property (Property.Handle).

Returns:com.sun.star.beans.Property

The Property object with the handle nHandle

getPropertyIdback to summary
protected Object getPropertyId(com.sun.star.beans.Property prop)

Returns the identifier object for a certain Property. The object must have been previously assigned to the Property object by assignPropertyId. Override this method if you want to implement your own mapping from Property objects to ids. Then you also need to override initMappings and assignPropertyId.

Parameters
prop:com.sun.star.beans.Property

The property for which the id is to be retrieved.

Returns:Object

The id object that identifies the storage used for the property's value.

See Also
registerProperty(Property, Object)
getPropertySetInfoback to summary
public synchronized com.sun.star.beans.XPropertySetInfo getPropertySetInfo()
getPropertyValueback to summary
public Object getPropertyValue(String name) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException
getPropertyValueback to summary
protected Object getPropertyValue(com.sun.star.beans.Property property)

Retrieves the value of a property. This implementation presumes that the values are stored in member variables of the furthest inheriting class (see convertPropertyValue) and that the variables are public. The property must have been registered, for example by registerProperty(Property, Object). The identifier Object argument must have been a String which was the name of the member variable holding the property value. When properties are to be stored differently one has to override this method as well as convertPropertyValue and setPropertyValueNoBroadcast.
If a value is stored in a variable of a primitive type then this method returns an instance of the respective wrapper class (e.g. java.lang.Boolean).

Parameters
property:com.sun.star.beans.Property

The property for which the value is to be retrieved.

Returns:Object

The value of the property.

getPropertyValuesback to summary
public Object[] getPropertyValues(String[] propNames)

If a value for a property could not be retrieved then the respective element in the returned array has the value null.

initMappingsback to summary
protected void initMappings()

Initializes data structures used for mappings of property names to property object, property handles to property objects and property objects to id objects. Override this method if you want to implement your own mappings. Then you also need to override putProperty,getProperty, getPropertyByHandle, assignPropertyId and getPropertyId.

postDisposingback to summary
protected void postDisposing()

Overrides com.sun.star.lib.uno.helper.ComponentBase.postDisposing.

Makes sure that listeners which are kept in aBoundLC (XPropertyChangeListener) and aVetoableLC (XVetoableChangeListener) receive a disposing call. Also those listeners are released.

Annotations
@Override
putPropertyback to summary
protected void putProperty(com.sun.star.beans.Property prop)

Stores a Property object so that it can be retrieved subsequently by getProperty(String),getProperties(),getPropertyByHandle(int). Override this method if you want to implement your own mapping from handles to Property objects and names to Property objects. Then you also need to override initMappings, getProperty(String),getProperties(),getPropertyByHandle(int).

Parameters
prop:com.sun.star.beans.Property

The Property object that is to be stored.

registerPropertyback to summary
protected void registerProperty(com.sun.star.beans.Property prop, Object id)

Registers a property with this helper class and associates the argument id with it. id is used to identify the storage of the property value. How property values are stored and retrieved is determined by the methods convertPropertyValue, setPropertyValueNoBroadcast and getPropertyValue These methods expect id to be a String which represents the name of a member variable which holds the property value. Only properties which are registered can be accessed. Registration has to occur during initialization of the inheriting class (i.e. within the constructor).

Parameters
prop:com.sun.star.beans.Property

The property to be registered.

id:Object

Identifies the properties storage.

See Also
getPropertyId
registerPropertyback to summary
protected void registerProperty(String name, int handle, Type type, short attributes, Object id)

Registers a property with this helper class and associates the argument id with it. It does the same as registerProperty(Property, Object). The first four arguments are used to construct a Property object. Registration has to occur during initialization of the inheriting class (i.e. within the constructor)

Parameters
name:String

The property's name (Property.Name).

handle:int

The property's handle (Property.Handle).

type:Type

The property's type (Property.Type).

attributes:short

The property's attributes (Property.Attributes).

id:Object

Identifies the property's storage.

registerPropertyback to summary
protected void registerProperty(String name, Type type, short attributes, Object id)

Registers a property with this class and associates the argument id with it. It does the same as registerProperty(Property, Object). The first three arguments are used to construct a Property object. The value for the Property.Handle is generated and does not have to be specified here. Use this method for registering a property if you do not care about the Property's handles. Registration has to occur during initialization of the inheriting class (i.e. within the constructor).

Parameters
name:String

The property's name (Property.Name).

type:Type

The property's type (Property.Type).

attributes:short

The property's attributes (Property.Attributes).

id:Object

Identifies the property's storage.

registerPropertyback to summary
protected void registerProperty(String propertyName, String memberName, short attributes)

Registers a property with this class. This method expects that property values are stored in member variables as is the case if the methods convertPropertyValue, setPropertyValueNoBroadcast and getPropertyValue(Property) are not overridden. It is presumed that the type of the member variable corresponds Property.Type. For example, if the TypeClass of Property.Type is to be a TypeClass.SHORT then the member must be a short or java.lang.Short. The handle for the property is generated.
If there is no member with the specified name or if the member has an incompatible type then a com.sun.star.uno.RuntimeException is thrown.

Parameters
propertyName:String

The name of the property.

memberName:String

The name of the member variable that holds the value of the property.

attributes:short

The property attributes.

registerPropertyback to summary
protected void registerProperty(String propertyName, short attributes)

Registers a property with this class. It is presumed that the name of property is equal to the name of the member variable that holds the property value.

Parameters
propertyName:String

The name of the property and the member variable that holds the property's value.

attributes:short

The property attributes.

See Also
registerProperty(String, String, short)
removePropertiesChangeListenerback to summary
public void removePropertiesChangeListener(com.sun.star.beans.XPropertiesChangeListener xPropertiesChangeListener)
removePropertyChangeListenerback to summary
public synchronized void removePropertyChangeListener(String propName, com.sun.star.beans.XPropertyChangeListener listener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException
removeVetoableChangeListenerback to summary
public synchronized void removeVetoableChangeListener(String propName, com.sun.star.beans.XVetoableChangeListener listener) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException
setFastPropertyValueback to summary
public void setFastPropertyValue(int nHandle, Object aValue) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.beans.PropertyVetoException, com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException
setPropertyValueback to summary
public void setPropertyValue(String name, Object value) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.beans.PropertyVetoException, com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException

Sets the value of a property. The idl description for this interfaces, stipulates that the argument value is an Any. Since a java.lang.Object reference has the same meaning as an Any this function accepts java anys (com.sun.star.uno.Any) and all other appropriate objects as arguments. The value argument can be one of these:

  • java.lang.Boolean
  • java.lang.Character
  • java.lang.Byte
  • java.lang.Short
  • java.lang.Integer
  • java.lang.Long
  • java.lang.Float
  • java.lang.Double
  • String
  • com.sun.star.uno.Type
  • objects which implement UNO interfaces
  • arrays which contain elements of the types above
  • com.sun.star.uno.Any containing an instance of one of the above types
Properties can have the attribute com.sun.star.beans.PropertyAttribute.MAYBEVOID, which means that the value (not the type) can be void. In order to assign a void value to a property one can either pass an Any which contains a null reference or pass null directly. In both cases the null reference is only accepted if the PropertyAttribute.MAYBEVOID attribute is set for the property. Properties which have the attribute MAYBEVOID set (Property.Attributes) can have a void value. The following considerations presume that the Property has that attribute set. Further, when mentioning an Any's value we actually refer to the object returned by Any.getObject. If the argument value is null, or it is an Any whose value is null (but with a valid Type) then the member variable used for storing the property's value is set to null. Therefore those properties can only be stored in objects and primitive types are not allowed (one can use the wrapper classes instead,e.g. java.lang.Byte) . If a property's value is kept in a member variable of type Any and that reference is still null then when setPropertyValue is called with value = null then the member variable is assigned an Any with type void and a null value. Or if the argument is an Any with a null value then it is assigned to the member variable. Further, if the variable already references an Any and setPropertyValue is called with value = null, then the variable is assigned a new Any with the same type as the previously referenced Any and with a null value.
Parameters
name:String

The name of the property.

value:Object

The new value of the property.

setPropertyValueback to summary
protected void setPropertyValue(com.sun.star.beans.Property prop, Object value) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.beans.PropertyVetoException, com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException

Sets the value of a property. It checks if the property's attributes (READONLY,MAYBEVOID), allow that the new value can be set. It also causes the notification of listeners.

Parameters
prop:com.sun.star.beans.Property

The property whose value is to be set.

value:Object

The new value for the property.

Exceptions
UnknownPropertyException:
See com.sun.star.beans.XPropertySet
PropertyVetoException:
See com.sun.star.beans.XPropertySet
WrappedTargetException:
See com.sun.star.beans.XPropertySet
setPropertyValueNoBroadcastback to summary
protected void setPropertyValueNoBroadcast(com.sun.star.beans.Property property, Object newVal) throws com.sun.star.lang.WrappedTargetException

Sets the value of a property. In this implementation property values are stored in member variables (see convertPropertyValue Notification of property listeners does not occur in this method. By overriding this method one can take full control about how property values are stored. But then, the convertPropertyValue and getPropertyValue(Property) must be overridden too. A Property with the MAYBEVOID attribute set, is stored as null value. Therefore the member variable must be an Object in order to make use of the property attribute. An exception is Any. The Any variable can be initially null, but once it is set the reference will not become null again. If the value is to be set to void then a new Any will be stored with a valid type but without a value (i.e. Any.getObject returns null). If a property has the READONLY attribute set, and one of the setter methods, such as setPropertyValue, has been called, then this method is not going to be called.

Parameters
property:com.sun.star.beans.Property

the property for which the new value is set

newVal:Object

the new value for the property.

Exceptions
WrappedTargetException:
An exception, which has to be made known to the caller, occurred during the setting of the value.
setPropertyValuesback to summary
public void setPropertyValues(String[] propNames, Object[] values) throws com.sun.star.beans.PropertyVetoException, com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException

If the array of property names contains an unknown property then it will be ignored.

com.sun.star.lib.uno.helper back to summary

private Class PropertySet.PropertySetInfo

extends Object
implements com.sun.star.beans.XPropertySetInfo
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public com.sun.star.beans.Property[]
public com.sun.star.beans.Property
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PropertySetInfoback to summary
private PropertySetInfo()

Method Detail

getPropertiesback to summary
public com.sun.star.beans.Property[] getProperties()
getPropertyByNameback to summary
public com.sun.star.beans.Property getPropertyByName(String name) throws com.sun.star.beans.UnknownPropertyException
hasPropertyByNameback to summary
public boolean hasPropertyByName(String name)