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

# Class ExpressionHandle

java.lang.Object
org.eclipse.birt.report.model.api.ElementDetailHandle
org.eclipse.birt.report.model.api.ValueHandle
org.eclipse.birt.report.model.api.ComplexValueHandle
org.eclipse.birt.report.model.api.ExpressionHandle

public class ExpressionHandle extends ComplexValueHandle
Simplifies working with expression properties. An expression value consists of two parts: the raw expression string if the type is not constant; or the value if the type is constant. If the type is constant, the value can be in String, Integer, DimensionValue, etc.

See Also:
  - `ExpressionType`

## Field Summary

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

`memberContext, propDefn`

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

`elementHandle`

## Constructor Summary

Constructors
Constructor
Description
`ExpressionHandle(DesignElementHandle element, org.eclipse.birt.report.model.core.MemberRef memberRef)`
Deprecated.
`ExpressionHandle(DesignElementHandle element, org.eclipse.birt.report.model.core.StructureContext context)`
Constructs an expression handle for the structure member.
`ExpressionHandle(DesignElementHandle element, org.eclipse.birt.report.model.metadata.ElementPropertyDefn thePropDefn)`
Constructs an expression handle for an element property.

## Method Summary

Modifier and Type
Method
Description
`Object`
`getExpression()`
Return the raw expression if the type is not constant.
`String`
`getStringExpression()`
Return the expression in string format.
`String`
`getType()`
Return the type of the expression.
`Object`
`getValue()`
Gets the value of the property as a generic object.
`void`
`setExpression(Object expr)`
Sets the raw expression if the type is not constant.
`void`
`setType(String type)`
Sets the type of the expression.

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

`getContext, getDefn, getDisplayValue, getPropertyDefn, getRawValue, getStringValue, isSet, setStringValue, setValue`

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

`getReference`

### 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`

## Constructor Details

### ExpressionHandle

public ExpressionHandle(DesignElementHandle element, org.eclipse.birt.report.model.core.StructureContext context)
Constructs an expression handle for the structure member.

Parameters:
  `element` - the design element handle
  `context` - the context for the member property

### ExpressionHandle

@Deprecated public ExpressionHandle(DesignElementHandle element, org.eclipse.birt.report.model.core.MemberRef memberRef)
Deprecated.
Constructs an expression handle for the structure member.

Parameters:
  `element` - the design element handle
  `memberRef` - the memberRef for the member property

### ExpressionHandle

public ExpressionHandle(DesignElementHandle element, org.eclipse.birt.report.model.metadata.ElementPropertyDefn thePropDefn)
Constructs an expression handle for an element property.

Parameters:
  `element` - handle to the element that defined the property.
  `thePropDefn` - definition of the expression property.

## Method Details

### getExpression

public Object getExpression()
Return the raw expression if the type is not constant. If the type is constant, returns the value.

Returns:
  the raw expression

### setExpression

public void setExpression(Object expr) throws SemanticException
Sets the raw expression if the type is not constant. If the type is constant, sets the value.

Parameters:
  `expr` - the raw expression or the value
Throws:
  `SemanticException`

### getType

public String getType()
Return the type of the expression.

Returns:
  the expression type

### setType

public void setType(String type) throws SemanticException
Sets the type of the expression.

Parameters:
  `type` - the expression type.
Throws:
  `SemanticException`

### getStringExpression

public String getStringExpression()
Return the expression in string format.

- if the type is not constant, return the raw expression;
- if the type is constant, return the value in string.

Returns:
  the raw expression or the value in string

### getValue

public Object getValue()
Description copied from class: `ComplexValueHandle`
Gets the value of the property as a generic object.

Overrides:
  `getValue` in class `ComplexValueHandle`
Returns:
  The value of the property or member as a generic object.