|
Class: InlineObject
Object
|
+--InlineObject
|
+--InlineObject::InlineObjectPrototype
- Package:
- stx:libbasic
- Category:
- Kernel-Classes
- Version:
- rev:
1.21
date: 2019/08/10 08:15:32
- user: cg
- file: InlineObject.st directory: libbasic
- module: stx stc-classLibrary: libbasic
WARNING: InlineObjects are an experimental feature.
InlineObjects are written as literals of the form:
#{
fieldName1: value1.
fieldName2: value2.
...
fieldNameN: valueN.
}
For example:
#{
firstName: 'Peter'.
lastName: 'Miller'.
age: 25.
}
#{
date: Date today.
time: Time now.
}
All inlineObjects will be instances of an anonymous subclass of me,
and provide getter protocol for their fields (e.g. firstName, lastName and age in the above example.
InlineObjects are immutable (no setters).
flushing
-
flushMapOfClasses
-
instance creation
-
slotNames: names values: slotValues
-
return a new inline object given slot names and slot values
usage example(s):
InlineObject slotNames:#('foo' 'bar' 'baz') values:#(1 2 3)
InlineObject slotNames:#('foo' 'bar' 'baz') values:#(1 2 3) mutable:false
|
-
slotNames: names values: slotValues mutable: mutable
-
return a new inline object given slot names and slot values
usage example(s):
InlineObject slotNames:#('foo' 'bar' 'baz') values:#(1 2 3)
InlineObject slotNames:#('foo' 'bar') values:#(1 2)
|
-
slotNamesAndValues: namesAndValues
-
return a new inline object given slot names and slot values as alternating elements
in the argument, namesAndValues
usage example(s):
InlineObject slotNamesAndValues:#('foo' 10 'bar' 20 'baz' 30)
|
-
slotNamesAndValues: namesAndValues mutable: beMutable
-
return a new inline object given slot names and slot values as alternating elements
in the argument, namesAndValues
usage example(s):
InlineObject slotNamesAndValues:#('foo' 10 'bar' 20 'baz' 30)
|
-
slotNamesAndValuesFromDictionary: namesAndValuesDict
-
return a new inline object given slot names and slot values as elements
in the argument, namesAndValuesDict
usage example(s):
InlineObject slotNamesAndValuesFromDictionary:(Dictionary withKeyValuePairs:#(('foo' 10) ('bar' 20) ('baz' 30)))
|
-
slotNamesAndValuesFromDictionary: namesAndValuesDict mutable: beMutable
-
return a new inline object, given slot names and slot values as elements
in the argument, namesAndValuesDict.
If the dictionary is unordered, slots are created in the sorted key order
usage example(s):
InlineObject
slotNamesAndValuesFromDictionary:(
Dictionary withKeyValuePairs:#(('foo' 10) ('bar' 20) ('baz' 30))
)
InlineObject
slotNamesAndValuesFromDictionary:(
OrderedDictionary withKeyValuePairs:#( ('bar' 20) ('baz' 30) ('foo' 10) )
)
|
prototype access
-
prototype
-
queries
-
classForSlotNames: slotNames mutable: mutable
-
return either an existing or a new class to represent
an inline object given its slot names
-
isAbstract
-
Return if this class is an abstract class.
True is returned here for myself only; false for subclasses.
Abstract subclasses must redefine this again.
comparing
-
= someObject
-
I conside someObject to be equal, if it has the same slotnames
-
hash
-
I redefine =; so I also have to redefine hash
-
isInlineObject
-
printing & storing
-
displayOn: aStream
-
#{ foo: 1 . bar: 2 } displayString
-
storeOn: aStream
-
#{ foo: 1 . bar: 2 } storeString
Object readFrom:( #{ foo: 1 . bar: 2 } storeString)
InlineObjectClassDescription
InlineObjectPrototype
|