Attributes are the most primitive elements from the complex data types.
Their role is to associate a value with a name.
Create a 'name' named attribute with 'jon' value.
$a typeof Attribute
$a.setLabel("name")
$a.setValue("jon")
print $a
name: jon
print $a.toXML
name="jon"
print $a.getName
name
print $a.getvalue
jon
This example show how to set attribute value
define AttrAssign [
static @att1="test" typeof String
static :main ($args typeof Series) [
$current typeof AttrAssign
print $current.toXML<AttrAssign att1="test"></AttrAssign>
AttrAssign@att1 = "hello"
print $current.toXML<AttrAssign att1="hello"></AttrAssign>
$current@att1 = "oh boy"
print $current.toXML<AttrAssign att1="oh boy"></AttrAssign>]]
Methods inherited from: Concept
| cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getErrorHandler, getInheritedConcepts, getResourceURI, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML, setResourceURI |
|
| Parameters: |
| : | The label of this Attribute. |
| : | The value of this Attribute. |
|
Constructs a new Attribute concept with the specified value and label.
Returns a string concept representing this Attribute's label.
define Test [
@attr="blue" label "AttrLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptAttribute("attr").getLabel
]
]
-- the result is --
AttrLabel
Returns a string concept representing this Attribute's name.
define Test [
@attr="blue" label "AttrLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptAttribute("attr").getName
]
]
-- the result is --
attr
Returns a concept representing this Attribute's value.
define Test [
@attr="blue" label "AttrLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptAttribute("attr").getValue
]
]
-- the result is --
blue
Returns this concept's value type.
define Test [
@attr="blue" label "AttrLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptAttribute("attr").getValueType
]
]
-- the result is --
String
| Parameters: |
| $label : | The new label to be set. |
|
Sets the label of this Attribute concept to the specified text.
define Test [
@attr="blue" label "AttrLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptAttribute("attr").getLabel
$test.getConceptAttribute("attr").setLabel("NewLabel")
print $test.getConceptAttribute("attr").getLabel
]
]
-- the result is --
AttrLabel
NewLabel
| Parameters: |
| $value : | The value to be set. |
|
Sets the value of this Attribute concept to the specified value.
define Test [
@attr="blue" label "AttrLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptAttribute("attr").getValue
$test.getConceptAttribute("attr").setValue("green")
print $test.getConceptAttribute("attr").getValue
]
]
-- the result is --
blue
green
Returns a stream representing the XML rendering of this concept.
define Test [
@attr="blue" label "AttrLabel"
static : main ($args typeof Series) [
$test typeof Test
print $test.getConceptAttribute("attr").toXML
]
]
-- the result is --
AttrLabel="blue"