class obix::ObixObj

sys::Obj
  obix::ObixObj

Source

ObixObj models an obix:obj element.

add

@Operator
This add(ObixObj kid)

Source

Add a child object. Throw ArgErr if this child is already parented or has a duplicate name. Return this.

clear

This clear()

Source

Remove all children objects. Return this.

contract

Contract contract := Contract.empty

Source

The list of contract URIs this object implemented as specified by is attribute.

display

Str? display

Source

Localized human readable string summary of the object.

displayName

Str? displayName

Source

Localized human readable version of the name attribute.

each

Void each(|ObixObj| f)

Source

Iterate each of the children objects.

elemName

Str elemName := "obj"

Source

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()

Source

Get the first child returned by list or null.

get

@Operator
ObixObj? get(Str name, Bool checked := true)

Source

Get a child by name. If not found and checked is true then throw NameErr, otherwise null.

has

Bool has(Str name)

Source

Return if there is child object by the specified name.

href

Uri? href

Source

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

Source

Reference to the graphical icon.

in

Contract? in

Source

The in contract for operations and feeds.

isEmpty

Bool isEmpty()

Source

Return is size is zero.

isNull

Bool isNull

Source

The null flag indicates the absense of a value.

last

ObixObj? last()

Source

Get the last child returned by list or null.

list

ObixObj[] list()

Source

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

Source

Inclusive maximum for value.

min

Obj? min

Source

Inclusive minium for value.

name

Str? name

Source

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()

Source

Get this objects href normalized against the root object's URI. Return null no href defined.

of

Contract? of

Source

The of contract for lists and feeds.

out

Contract? out

Source

The out contract for operations.

parent

ObixObj? parent { private set }

Source

Parent object or null if unparented.

precision

Int? precision

Source

Number of decimal places to use for a real value.

range

Uri? range

Source

Reference to the range definition of an enum or bool value.

readXml

static ObixObj readXml(InStream in, Bool close := true)

Source

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

This remove(ObixObj kid)

Source

Remove the specified child object by reference. Throw ArgErr if not my child. Return this

root

ObixObj root()

Source

Get the root ancestor of this object, or return this if no parent.

size

Int size()

Source

Return number of child objects.

status

Status status := Status.ok

Source

Status facet indicates quality and state.

toStr

virtual override Str toStr()

Source

Return string representation.

trap

virtual override Obj? trap(Str name, Obj?[]? args := null)

Source

If the name maps to a child object, then return that child's value. Otherwise route to Obj.trap.

tz

TimeZone? tz

Source

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

Source

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

Source

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()

Source

Get the value encoded as a string. The string is not XML escaped. If value is null return "null".

valType

Type? valType()

Source

Return this element type's Fantom value type or null if this is a non-value type such as obj.

writable

Bool writable

Source

Specifies is this object can be written, or false if readonly.

writeXml

virtual Void writeXml(OutStream out, Int indent := 0)

Source

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.