class obix::ObixObj
sys::Obj obix::ObixObj
ObixObj models an obix:obj
element.
- add
-
@Operator
This add(ObixObj kid)Add a child object. Throw ArgErr if this child is already parented or has a duplicate name. Return this.
- clear
-
This clear()
Remove all children objects. Return this.
- contract
-
Contract contract := Contract.empty
The list of contract URIs this object implemented as specified by
is
attribute. - display
-
Str? display
Localized human readable string summary of the object.
- displayName
-
Str? displayName
Localized human readable version of the name attribute.
- each
-
Iterate each of the children objects.
- elemName
-
Str elemName := "obj"
The XML element name to use for this object. If not one of the valid oBIX element names then throw ArgErr. Valid element names are:
obj, bool, int, real, str, enum, uri, abstime, reltime, date, time, list, op, feed, ref, err
- first
-
ObixObj? first()
Get the first child returned by
list
or null. - get
-
@Operator
ObixObj? get(Str name, Bool checked := true)Get a child by name. If not found and checked is true then throw NameErr, otherwise null.
- has
-
Return if there is child object by the specified name.
- href
-
Uri? href
URI of this object. The root object of a document must have an absolute URI, other objects may have a URI relative to the document root. See
normalizedHref
to get this href normalized against the root object. - icon
-
Uri? icon
Reference to the graphical icon.
- in
-
Contract? in
The
in
contract for operations and feeds. - isEmpty
-
Bool isEmpty()
Return is size is zero.
- isNull
-
Bool isNull
The null flag indicates the absense of a value.
- last
-
ObixObj? last()
Get the last child returned by
list
or null. - list
-
ObixObj[] list()
Get a readonly list of the children objects or empty list if no children. If iterating the children it is more efficient to use
each
. - max
-
Obj? max
Inclusive maximum for value.
- min
-
Obj? min
Inclusive minium for value.
- name
-
Str? name
Programatic name of the object which defines role of this object in its parent. Throw UnsupportedErr if an attempt is made to set the name once mounted under a parent.
- normalizedHref
-
Uri? normalizedHref()
Get this objects
href
normalized against the root object's URI. Return null no href defined. - of
-
Contract? of
The
of
contract for lists and feeds. - out
-
Contract? out
The
out
contract for operations. - parent
-
ObixObj? parent { private set }
Parent object or null if unparented.
- precision
-
Int? precision
Number of decimal places to use for a real value.
- range
-
Uri? range
Reference to the range definition of an enum or bool value.
- readXml
-
static ObixObj readXml(InStream in, Bool close := true)
Parse an XML document into memory as a tree of ObixObj. If close is true, then the input stream is guaranteed to be closed.
- remove
-
Remove the specified child object by reference. Throw ArgErr if not my child. Return this
- root
-
ObixObj root()
Get the root ancestor of this object, or return
this
if no parent. - size
-
Int size()
Return number of child objects.
- status
-
Status status := Status.ok
Status facet indicates quality and state.
- toStr
-
virtual override Str toStr()
Return string representation.
- trap
-
virtual override Obj? trap(Str name, Obj?[]? args := null)
If the name maps to a child object, then return that child's value. Otherwise route to
Obj.trap
. - tz
-
TimeZone? tz
TimeZone facet assocaited with abstime, date, and time objects. This field is automatically updated when
val
is assigned a DateTime unless its timezone is UTC or starts with "Etc/". After decoding this field is set only if an explicit "tz" attribute was specified. - unit
-
Unit? unit
Unit of measurement for int and real values. We only support units which are predefind in the oBIX unit database and specified using the URI "obix:units/". These units are mapped to the
Unit
API. If an unknown unit URI is decoded, then it is silently ignored and this field will be null. - val
-
Obj? val
Object value for value object types:
- obix:bool => sys::Bool
- obix:int => sys::Int
- obix:real => sys::Float
- obix:str => sys::Str
- obix:enum => sys::Str
- obix:uri => sys::Uri
- obix:abstime => sys::DateTime
- obix:reltime => sys::Duration
- obix:date => sys::Date
- obix:time => sys::Time
If the value is not one of the types listed above, then ArgErr is thrown. If the value is set to non-null, then the
elemName
is automatically updated. - valToStr
-
Str valToStr()
Get the value encoded as a string. The string is not XML escaped. If value is null return "null".
- valType
-
Type? valType()
Return this element type's Fantom value type or null if this is a non-value type such as
obj
. - writable
-
Bool writable
Specifies is this object can be written, or false if readonly.
- writeXml
-
virtual Void writeXml(OutStream out, Int indent := 0)
Write this ObixObj as an XML document to the specified stream. No XML prolog is specified so that this method can used to write a snippet of the overall document.