setProperty
Sets a property to the CDocBuilderValue object.
Please note, that for the
.docbuilderfile theCDocBuilderValue.setPropertymethod is not used.
Syntax
void setProperty(String name, Object value);
Parameters
| Parameter | Type | Description |
|---|---|---|
| name | String | The name of the CDocBuilderValue object property. |
| value | Object | The value of the CDocBuilderValue object property. |
Example
Java
CDocBuilder.initialize("");
CDocBuilder builder = new CDocBuilder();
CDocBuilderContext context = builder.getContext();
CDocBuilderValue global = context.getGlobal();
CDocBuilderValue api = global.get("Api");
CDocBuilderValue doc = api.call("GetDocument");
doc.setProperty("color", {"zX":{"red":112,"green":173,"blue":71,"alpha":255},"type":"srgb","Zvf":null,"type":"uniColor"});
CDocBuilder.dispose();
There are two more ways to set a property to the CDocBuilderValue object:
-
use the
setmethod that takes the object property name and value as arguments:void set(String name, Object value);Example
Java
CDocBuilder.initialize("");
CDocBuilder builder = new CDocBuilder();
CDocBuilderContext context = builder.getContext();
CDocBuilderValue global = context.getGlobal();
CDocBuilderValue api = global.get("Api");
CDocBuilderValue doc = api.call("GetDocument");
doc.set("color", {"zX":{"red":112,"green":173,"blue":71,"alpha":255},"type":"srgb","Zvf":null,"type":"uniColor"});
CDocBuilder.dispose(); -
use the
default[]postfix expression:property CDocBuilderValue default[String]Example
Java
CDocBuilder.initialize("");
CDocBuilder builder = new CDocBuilder();
CDocBuilderContext context = builder.getContext();
CDocBuilderValue global = context.getGlobal();
CDocBuilderValue api = global.get("Api");
CDocBuilderValue doc = api.call("GetDocument");
doc["color", {"zX":{"red":112,"green":173,"blue":71,"alpha":255},"type":"srgb","Zvf":null,"type":"uniColor"}];
CDocBuilder.dispose();