ebisu.ebisu_dart_meta library

Support for storing dart meta data for purpose of generating Dart code. Essentially this is a model of structural code items that comprise dart systems. Things like libraries (Library), classes (Class), class members (Member), pubspecs (PubSpec), etc. A very nice feature of Dart is the dot-dot .. operator, which allows one to conveniently string together accessor calls to objects. For example, the following is the structure of the imported id library.

  library('id')
  ..doc = '...'
  ..includesLogger = true
  ..imports = [
    'dart:convert'
  ]
  ..classes = [
    class_('id')
    ..doc = "Given an id (all lower case string of words separated by '_')..."
    ..hasCtorSansNew = true
    ..members = [
      member('id')
      ..doc = "String containing the lower case words separated by '_'"
      ..access = Access.RO
      ..isFinal = true,
      member('words')
      ..doc = "Words comprising the id"
      ..type = 'List<String>'
      ..access = Access.RO
      ..isFinal = true
    ]
  ]
];

The libraries are composed into a system and the system is generated. So, all the code structure in ebisu was generated by itself. Code generation of this sort is much more useful in the more verbose languages like C++ where things like ORM, object serialization, object streaming etc are very boilerplate. However some good use cases exist in Dart, like generating the structure of a large Dart library from an existing spec or data input (e.g. imagine trying to create a Dart library to support a FIX specification which is stored in XML). A simple use that is provided as an extension is the ability take a simple Altova UML model in XMI format and convert it to Dart classes with JSON support.

Classes

Access
Access for member variable - ia - inaccessible, ro - read/only, rw read/write
App
Defines a dart web application. For non-web console app, use Script
ArgType
Specifies type of argument like (https://docs.python.org/2/library/optparse.html#optparse-standard-option-types)
Benchmark
Class
Metadata associated with a Dart class [...]
Ctor
Metadata associated with a constructor
Enum
Defines an enum. [...]
EnumValue
Define the id and value for an enum value
InstallationWalker
Walks installation and creates single emacs file with utility functions
Library
Defines a dart library - a collection of parts
LibraryGroup
List of libraries supporting a feature set. [...]
Member
Metadata associated with a member of a Dart class
Part
Defines a dart part - as in 'part of' source file
PolymerTransformer
A polymer transformer entry
PubDependency
A dependency of the system
PubDepType
Dependency type of a PubDependency
PubSpec
Information for the pubspec of the system
PubTransformer
Entry in the transformer sections
Script
A typical script - (i.e. like a bash/python/ruby script but in dart)
ScriptArg
An agrument to a script
System
Defines a dart system (collection of libraries and apps)
Variable
Variable with an id and type

Properties

camel JsonKeyFormat
final
capCamel JsonKeyFormat
final
IA → dynamic
read-only
RO → dynamic
read-only
RW → dynamic
read-only
snake JsonKeyFormat
final
WO → dynamic
read-only

Functions

app(dynamic _id) App
benchmark(String _id) Benchmark
class_(dynamic _id) Class
cleanImports(List<String> dirtyImports) List<String>
Given a list of dirtyImports, cleans them up and removes duplicates
enum_(dynamic _id) Enum
enumValue(dynamic _id, [ dynamic value ]) EnumValue
Create a EnumValue sans new, for more declarative construction
generalMapKeyType(String t) String
id(String _id) Id
importStatement(String s) String
importUri(String s) String
isClassJsonable(String className) bool
Returns true if the class name alone indicates the type may be convertible to json
isJsonableType(String t) bool
isListType(String t) bool
isMapType(String t) bool
isSetType(String t) bool
isSplayTreeSetType(String t) bool
jsonListValueType(String t) String
jsonMapValueType(String t) String
library(dynamic _id) Library
libraryGroup(dynamic _id) LibraryGroup
member(String _id) Member
Create new member from snake case id
part(dynamic _id) Part
pubdep(String name) PubDependency
pubspec(String _id) PubSpec
script(String _id) Script
scriptArg(String _id) ScriptArg
system(dynamic _id) System
templateParameterType(String t) String
testLibrary(String s) Library
variable(dynamic _id) Variable

Enums

JsonKeyFormat
When serializing json, how to name the keys