Skip to content

Instantly share code, notes, and snippets.

@ctomc
Created February 5, 2015 15:13
Show Gist options
  • Save ctomc/bc515ae6ab6b871f02d8 to your computer and use it in GitHub Desktop.
Save ctomc/bc515ae6ab6b871f02d8 to your computer and use it in GitHub Desktop.
Enhanced read/write attribute operations

Expand standard read/write operations

:write-attribute enhacements for complex attributes

Map write enhancements

:write-attribute(name=map-attribute.myKey value="newValue")

List write enhancements

:write-attribute(name=list-attribute[1] value="new-element-value")
:write-attribute(name=list-attribute.element-value value="new-element-value")

Map read enhancements

# return value of map-attribute with key "myKey"
:read-attribute(name=map-attribute.myKey)

List read enhancements

# return element under index 5 of list-attribute
:read-attribute(name=list-attribute[5])

Generic complex attributes enhancments

# return property.subproperty from complex attribute
:read-attribute(name=complex-attribute.property.subproperty)
# return subproperty of 5th property from complex attribute
:read-attribute(name=complex-attribute[5].subproperty)

# set subproperty of 5th property of complex attribute
:write-attribute(name=complex-attribute[5].subproperty, value="new-value")

# set property.subproperty.subsubproperty of attribute "complext-attribute to "new-value" 
:write-attribute(name=complex-attribute.property.subproperty.subsubproperty, value="new-value")

# return value of complex attribute with key "myKey"
:read-attribute(name=complex-attribute.myKey)
# return "property" of complex-attribute element on index 5
:read-attribute(name=complex-attribute[5].property)
# return object of complex-attribute element on index 5
:read-attribute(name=complex-attribute[5])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment