Search in sources :

Example 1 with BMessage

use of org.ballerinalang.model.values.BMessage in project carbon-apimgt by wso2.

the class SetProperty method execute.

@Override
public BValue[] execute(Context context) {
    BMessage msg = (BMessage) getRefArgument(context, 0);
    String propertyName = getStringArgument(context, 0);
    BValue propertyValue = getRefArgument(context, 1);
    if (propertyName != null && propertyValue != null) {
        msg.setProperty(propertyName, propertyValue);
    }
    return VOID_RETURN;
}
Also used : BMessage(org.ballerinalang.model.values.BMessage) BValue(org.ballerinalang.model.values.BValue)

Example 2 with BMessage

use of org.ballerinalang.model.values.BMessage in project carbon-apimgt by wso2.

the class GetProperty method execute.

@Override
public BValue[] execute(Context context) {
    BMessage msg = (BMessage) getRefArgument(context, 0);
    String propertyName = getStringArgument(context, 0);
    BValue propertyValue = (BValue) msg.getProperty(propertyName);
    if (propertyValue == null) {
        return VOID_RETURN;
    }
    return getBValues(propertyValue);
}
Also used : BMessage(org.ballerinalang.model.values.BMessage) BValue(org.ballerinalang.model.values.BValue)

Aggregations

BMessage (org.ballerinalang.model.values.BMessage)2 BValue (org.ballerinalang.model.values.BValue)2