new Object()
Represents baja:Object
in BajaScript.
Since this Constructor represents an abstract class, it should never
be directly used to create a new Object.
Extends
Methods
-
equals(obj)
-
Indicates whether some other object is equal to this one.
Parameters:
Name Type Description obj
Object the reference object with which to compare.
- Inherited From:
Returns:
true if this object is the same as the obj argument; false otherwise.
- Type
- Boolean
-
equivalent(obj)
-
Equivalence test.
equivalent()
is used to compare if two Objects have equivalent
state, but might not want to return true for equals since it
it has implied semantics for many operations. The default
implementation returns the result of baja.Object#equals.Parameters:
Name Type Description obj
Returns:
- Type
- Boolean
-
getAgents( [is], batch)
-
Returns a promise that resolves to the agent list for this Object.
Parameters:
Name Type Argument Description is
Array.<String> <optional>
An optional array of filters to add to the
agent query.batch
baja.comm.Batch An optional object used to batch network
calls together.Returns:
A promise that will resolve with the Agent Info.
- Type
- Promise
-
getIcon()
-
Return the Object's Icon.
Returns:
- Type
- baja.Icon
-
getType()
-
Get the type of this instance.
Returns:
- Type
- Type
-
toString( [cx])
-
Returns the String representation of this Object.
When implementing
toString()
on one of your own Objects, it should
adhere to the following contract.- When called with no arguments, it must return a string directly.
- It can also be called with an object literal. In this case, it may
return a Promise to be resolved with a string, or it may return a string
directly as normal. This case is sort of analogous tojavax.baja.sys.Localizable#toString(Context)
.
Therefore, when calling
toString()
on an Object of unknown Type using an
object literal as an argument, it's important to wrap the call inPromise.resolve()
.Parameters:
Name Type Argument Description cx
Object <optional>
optional context information to be used when
formatting the stringReturns:
a string (if no context passed), or
either a string or a Promise (if context passed).Examples
When no context is passed, toString() must always return a string directly.
var bool = comp.get('boolean'); baja.outln(bool.toString()); // 'false'
When a context is passed, some Objects may return a Promise.
var bool = comp.get('boolean'); bool.toString({ trueText: 'Yes', falseText: 'No' }) .then(function (str) { baja.outln(str); // 'No' });
If you don't know the type of the Object, use Promise.resolve() for safety.
var displayFacets = comp.get('displayFacets'), value = comp.get('value'); Promise.resolve(value.toString(displayFacets.toObject())) .then(function (str) { baja.outln(str); // formatted according to displayFacets });
-
valueOf()
-
Return the inner value of the object.
By default the object's instance is returned.
- Inherited From:
Returns:
the inner value of the object or just the object's instance.
- Type
- *