eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'InlineObject':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: InlineObject


Inheritance:

   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

Description:


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


Class protocol:

flushing
o  flushMapOfClasses

instance creation
o  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

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

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

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

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

o  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
o  prototype

queries
o  classForSlotNames: slotNames mutable: mutable
return either an existing or a new class to represent
an inline object given its slot names

o  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.


Instance protocol:

comparing
o  = someObject
I conside someObject to be equal, if it has the same slotnames

o  hash
I redefine =; so I also have to redefine hash

o  isInlineObject

printing & storing
o  displayOn: aStream
#{ foo: 1 . bar: 2 } displayString

o  storeOn: aStream
#{ foo: 1 . bar: 2 } storeString
Object readFrom:( #{ foo: 1 . bar: 2 } storeString)


Private classes:

    InlineObjectClassDescription
    InlineObjectPrototype


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 26 Apr 2024 19:47:39 GMT