domain-spec Pub

Domain Samples

Make sure your classes include a key attribute, unique. Otherwise, one random key is assigned for you and all sorts of funny and entertaining side effects may occur...

NOTE that these classes below won't work with persistence until you run this story - which will register and connect the postgress and other databases.

First class is annotated for persistance, although annotations are static and we prefer the registration, see below:

no inventory registered
class SampleDevice <stereo,stereo> (
key,
ip <@column>,
key,
ip <@column>
)

anno  (  inventory="diesel.db.postgres"="diesel.db...)

listAll | new
class SampleCell <stereo,stereo>extends SampleDeviceSampleDevice (
key,
ip <@column>,
sectors:Array[SampleSector],
template:<>SampleTemplate,
cpes:<>Array[SampleCpe],
key,
ip <@column>,
sectors:Array[SampleSector],
template:<>SampleTemplate,
cpes:<>Array[SampleCpe]
) ANNO(  inventory:String="diesel.db.postgres"="diesel.db.postgres",   inventory:String="diesel.db.postgres"="diesel.db.postgres")

This classes are registered, see the register message below - this is the preferred approach, as it's more dynamic:

no inventory registered
class SampleTemplate (
key,
template,
key,
template
)
no inventory registered
class SampleSector (
key,
azimuth,
key,
azimuth
)
no inventory registered
class SampleCpeextends SampleDeviceSampleDevice (
key,
ip,
courseRef:<>TestCourse,
key,
ip,
courseRef:<>TestCourse
)

Samples for testing

no inventory registered
class TestClassInv1 (
key,
someValue,
ref2:<>TestClassInv2,
key,
someValue,
ref2:<>TestClassInv2
)

anno  (  inventory="diesel.db.col"="diesel.db...)

listAll | new
class TestClassInv2 (
key,
someValue,
key,
someValue
) ANNO(  inventory:String="diesel.db.col"="diesel.db.col",   inventory:String="diesel.db.col"="diesel.db.col")

Defining classes

Note that inside a class definition, you can't have free text, just other constructs.

no inventory registered
class TestClass1{

   def: simple
   def: withParms (x, y)
   def: withEmptyBody (x, y)
   msg: simpleMsg
   msg: expandedMsg
   def: simple
   def: withParms (x, y)
   def: withEmptyBody (x, y)
   msg: simpleMsg
   msg: expandedMsg

}

$when:: TestClass1.simpleMsg
   a.b

no inventory registered
no inventory registered
no inventory registered
class TestContainer [T]
no inventory registered
class TestEmptyBody

anno  (  prop3="value"="value")

anno  (  prop1="value"="value",   prop2="value"="value")

no inventory registered
class TestAnnotated ANNO(  prop1:String="value"="value",   prop2:String="value"="value",   prop3:String="value"="value")
no inventory registered
class TestWithParms (
parm1,
slainvokedid:<>SLA,
list3:Array[TestContainer],
parm1,
slainvokedid:<>SLA,
list3:Array[TestContainer]
)


Was this useful?    

By: Razie | 2020-10-16 .. 2022-10-21 | Tags: spec , dsl , DslDomain , private


Viewed 529 times ( | History | Print ) this page.

You need to log in to post a comment!

© Copyright DieselApps, 2012-2024, all rights reserved.