Package org.eclipse.birt.report.model.api

# Class FactoryPropertyHandle

java.lang.Object
org.eclipse.birt.report.model.api.ElementDetailHandle
org.eclipse.birt.report.model.api.FactoryPropertyHandle

public class FactoryPropertyHandle extends ElementDetailHandle
A specialized handle for use when creating the Factory data structures. This handle caches the element definition and property value. It uses specialized property resolution rules:

- A property value is either a style property or a non-style property.
- A non-style property is set if this element, or any of its ancestor elements, provide a value. It is also considered set if the system provides a default value.
- A property value is considered set only if it is set in the private style of this element or an ancestor element; it is not considered set if it is inherited from a shared style.

The various "get" methods also have special meanings: they convert property values to the format needed by the Factory.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected org.eclipse.birt.report.model.metadata.ElementPropertyDefn`
`propDefn`
Handle to the design element.
`protected Object`
`value`
The cached property value.

### Fields inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle

`elementHandle`

## Constructor Summary

Constructors
Constructor
Description
`FactoryPropertyHandle(DesignElementHandle element, org.eclipse.birt.report.model.metadata.ElementPropertyDefn prop)`
Constructs a factory property handle with the given `DesignElementHandle` and the definition of the property.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`getBooleanValue()`
Returns the value as a Boolean.
`String`
`getColorValue()`
Gets the CSS color value.
`double`
`getFloatValue()`
Returns the value as a double.
`int`
`getIntValue()`
Returns the property value as an integer.
`BigDecimal`
`getNumberValue()`
Returns the value as a number (BigDecimal).
`String`
`getStringValue()`
Returns the value as a non-localized string.
`Object`
`getValue()`
Returns the cached factory property value.
`boolean`
`isSet()`
Tests whether this property value is set for this element.
`boolean`
`isStyleProperty()`
Tests whether this is a style property.

### Methods inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle

`getDesign, getElement, getElementHandle, getModule`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### propDefn

protected org.eclipse.birt.report.model.metadata.ElementPropertyDefn propDefn
Handle to the design element.

### value

protected Object value
The cached property value.

## Constructor Details

### FactoryPropertyHandle

public FactoryPropertyHandle(DesignElementHandle element, org.eclipse.birt.report.model.metadata.ElementPropertyDefn prop)
Constructs a factory property handle with the given `DesignElementHandle` and the definition of the property.

Parameters:
  `element` - handle to the design element. It provides the Factory context.
  `prop` - the definition of the property

## Method Details

### getValue

public Object getValue()
Returns the cached factory property value.

Returns:
  the cached factory property value.
See Also:
  - `DesignElement.getFactoryProperty(Module, ElementPropertyDefn)`

### isStyleProperty

public boolean isStyleProperty()
Tests whether this is a style property.

Returns:
  `true` if this is a style property, otherwise `false`.

### isSet

public boolean isSet()
Tests whether this property value is set for this element. It is set if it is defined on this element or any of its parents, or in the element's private style. It is considered unset if it is set on a shared style.

Returns:
  `true` if the value is set, `false` if it is not set

### getIntValue

public int getIntValue()
Returns the property value as an integer.

Returns:
  The value as an integer. Returns 0 if the value cannot be converted to an integer.

### getStringValue

public String getStringValue()
Returns the value as a non-localized string.

Returns:
  The value as a non-localized string.

### getFloatValue

public double getFloatValue()
Returns the value as a double.

Returns:
  The value as a double. Returns 0 if the value cannot be converted to a double.

### getNumberValue

public BigDecimal getNumberValue()
Returns the value as a number (BigDecimal).

Returns:
  The value as a number. Returns `null` if the value cannot be converted to a number.

### getBooleanValue

public boolean getBooleanValue()
Returns the value as a Boolean.

Note: This method returns false if the value is unset. It DOES NOT return the default value for the property. Call `isSet` before calling this method to determine if the property is set.

Returns:
  the value as a boolean. Returns `false` if the value cannot be converted to a boolean, or if the value is not set.

### getColorValue

public String getColorValue()
Gets the CSS color value. This is either a CSS (pre-defined) color name or an RGB value encoded in CSS format: rgb(r,g,b). Returns `null` if the property is not set.

Returns:
  the color value as a string