Atomic Domain Languages (ADL) is a strongly Typed system. typed system. Atomic Domain Languages focuses on real-world practices for building thing applications on the cloud as well as distributed and concurrent computing environments.
Similar to traditional programming languages like C, C#, etc there is a notion of static types i.e. the basic types that are defined by the A-Stack out-of-the box. The major advantage of ADL is the flexibility and productivity it offer to create dynamic types using simple syntax of Def XML Named Element. If you are coming from a dynamic type language, ADL will solve your performance and maintainability problems while maintaining productivity.
Types are defined in the context of Thing Definition Language (TDL). Out-of-the box TDL types can be categorized into three groups all inheriting from Entity:
Code Block |
---|
language | xml |
---|
title | Root of all types |
---|
linenumbers | true |
---|
|
<Def name="Entity" documentation="The root of all types"/> |
- Atom - This is the root for all primitive types
- System - Marker of all system types.
- Container - Root of all composite types
Image Added
Examples of Using Primitive Types
Primitive types can be used in standard containers (ThingModel, DataModel,, ThingFacet, AppModel, AppFacet) or custom containers (types) defined by users.
General Usage of Primitive Types
Primitive types usage within containers requires primitive type as an XML Named Element. It takes four modifiers -
- Name - Your name of the primitive type
- Cardinality - Array of Primitive Types. It takes format "m..n" where m = minimum value; n = maximum value
- Alt - Alternative name
- Default - Default value to use at the time of instantiate
Code Block |
---|
language | xml |
---|
title | General Usage of Primitive Types |
---|
linenumbers | true |
---|
|
<PrimitiveTypeName Name=".." Cardinality="m..n" Alt="..." Default=""/> |
String
Code Block |
---|
language | xml |
---|
title | ZoneInfo DataModel using ZoneName as String |
---|
linenumbers | true |
---|
|
<DataModel Name="ZoneInfo">
<String name="ZoneName"/>
</DataModel> |
Array of Primitive Types
Array of Primitive types is possible using Cardinality modifier at the time of usage
Code Block |
---|
language | xml |
---|
title | ZoneInfo DataModel using ZoneName as Array of String |
---|
linenumbers | true |
---|
|
<DataModel Name="ZoneInfo">
<String name="ZoneName" cardinality="0..n"/>
</DataModel> |
DateTime
DataTime uses Java SimpleDateFormat notation. Please refer to here for SimpleDateFormat
Code Block |
---|
language | xml |
---|
title | ZoneInfo DataModel using ZoneName as String |
---|
linenumbers | true |
---|
|
<DataModel Name="ZoneInfo">
<DateTime name="RecordDate" format="$SimpleDateFormat(yyyy-MM-dd'T'HH:mm:ss'Z')"/>
</DataModel> |