Class baja.Facets
Extends
baja.Simple.
Represents a BFacets in BajaScript.
BFacets is a map of name/value pairs used to annotate a BComplex's Slot or to just provide additional metadata about something. The values of facets may only be BIDataValues which are a predefined subset of simples.
When creating a Simple, always use the 'make' method instead of creating a new Object.
Defined in: obj.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
baja.Facets.NULL
NULL Facets instance.
|
- Fields borrowed from class baja.Value:
- newCopy
- Fields borrowed from class baja.Object:
- equivalent, getIcon
| Method Attributes | Method Name and Description |
|---|---|
|
decodeFromString(str)
Decode a String to a Facets.
|
|
|
Encode Facets to a String.
|
|
|
get(key, def)
Return a value from the map for the given key
|
|
| <static> |
baja.Facets.getFacetsFromObject(obj)
Return the facets for the given object.
|
|
getKeys()
Return a copy of the Facets keys.
|
|
|
make(keys, values)
Make a Facets.
|
|
| <static> |
baja.Facets.make(keys, values)
Make a Facets object.
|
|
toString()
Return a String representation of the Facets.
|
|
|
valueOf()
Return the value of the Facets.
|
- Methods borrowed from class baja.Simple:
- equals
Field Detail
<static>
baja.Facets.NULL
NULL Facets instance.
Method Detail
{baja.Facets}
decodeFromString(str)
Decode a String to a Facets.
- Parameters:
- {String} str
- Returns:
- {baja.Facets}
{String}
encodeToString()
Encode Facets to a String.
- Returns:
- {String}
get(key, def)
Return a value from the map for the given key
- Parameters:
- {String} key
- the key used to look up the data value
- def Optional
- if defined, this value is returned if the key can't be found.
- Returns:
- the data value for the key (null if not found)
<static>
{baja.Facets}
baja.Facets.getFacetsFromObject(obj)
Return the facets for the given object.
If the facets can't be found then baja.Facets.DEFAULT is returned.
- Parameters:
- obj
- Returns:
- {baja.Facets}
{Array}
getKeys()
Return a copy of the Facets keys.
- Returns:
- {Array} all of the keys (String) used in the Facets
{baja.Facets}
make(keys, values)
Make a Facets.
- Parameters:
- {Array} keys
- an array of keys for the facets. The keys must be Strings.
- {Array} values
- an array of values for the facets. The values must be BajaScript Objects whose Type implements BIDataValue.
- Returns:
- {baja.Facets} the Facets.
<static>
{baja.Facets}
baja.Facets.make(keys, values)
Make a Facets object. This function can either take two Array objects
for keys and values, two Facets or two Object Literals. In the latter two cases, a new
Facets object will be returned containing a combination of keys and values
from both input Facets objects. If a key exists on both Facets objects,
the value from the second Facets will take precedence.
- Parameters:
- {Array|baja.Facets|Object} keys
- an array of keys for the facets. The keys must be Strings. (This may also be a Facets (or Object Literal) object whose values will be combined with the second parameter. Values in this object will be overwritten by corresponding values from the other).
- {Array|baja.Facets|Object} values
- an array of values for the facets. The values must be BajaScript Objects whose Type implements BIDataValue. (This may also be a Facets (or Object Literal) object whose values will be combined with the first parameter. Values in this object will overwrite corresponding values on the other.)
- Returns:
- {baja.Facets} the Facets
{String}
toString()
Return a String representation of the Facets.
- Returns:
- {String}
{String}
valueOf()
Return the value of the Facets.
- Returns:
- {String}