ビルダー
ビルダーを使用すると、ユーザーはより便利な方法でオブジェクトとオブジェクト階層を構成できます。階層内の各オブジェクトを手動でインスタンス化してそのプロパティを 1 つずつ設定する代わりに、専用のビルダーを使用して、より簡潔で直感的な方法で同じデータ構造を作成できます。
例として、家を建てているとしましょう。
家には住所が必要です。住所自体はいくつかの項目で構成されており、その中にたくさんの部屋があり、それぞれに 2 つのプロパティが必要です。
面倒な方法の代わりに、ビルダーはあなたに取るべき構文上の近道を与えます:undefined
コードの構造自体は作成されたオブジェクト間の依存関係を反映しているため、コードを見ると、作成されたオブジェクトグラフの構造を素早く把握できます。ビルダーは互いに入れ子になっており、プロパティを保持できます。プロパティ値とビルダーの相互ネストの両方が、その背後に構築されたオブジェクト階層に変換されます。
MPS は、いくつかの言語 - JavaBeans、XML、XMLSchema、または XMLQuery が最も有名なユーザー - の一部として、便利なビルダーを直接あなたの玄関に導きます。
ビルビルダー
To build your own builder, you first need to invoke New -> j.m.baseLanguage.builders.SimpleBuilders. Now you define builders for each object type that participates in the hierarchy. These builders hold their own properties and children, out of which they build the requested data structure. To stick to our earlier "House building" example, check out the sample below:
We defined a builder for the Room class as well as for the Address class and also a root builder for the House class. Root builders, unlike plain builders, can be used directly in user code after the new keyword. Notice also that we have two builders for the Room class. The first definition allows properties to be nested inside the room block, while the second allows the two properties to come directly as parameters to the room method call. Both approaches can certainly be combined in a single builder.
The House, Room and Address classes in our case are ordinary classes with methods and properties. The methods as well as setters for the properties manipulated in builders must be visible to the builders. The "package" visibility will do in typical cases. To give you an example, see below the House class definition from our example.
関連ページ:

型拡張メソッド
言語jetbrains.mps.extensionMethodsは、Java の静的メソッドと同じように、新しく定義されたメソッドまたはオーバーライドされたメソッドで有効な MPS 型を拡張する方法を提供します。"This is an ordinary string with a surpricin
他の言語
ここでは便利な BaseLanguage 拡張をいくつか紹介しますチェックドット:言語:jetbrains.mps.baseLanguage.checkedDots チェックドット表現は、オペランドの NULL チェックで拡張されたドット式です。オペランドが NULL の場合、チェックされたドット式全体の値が NULL になります。それ以外の場合は、対応するドット式の値に評価されます。チェックドット式を作成する方法ドット表現をチェックするインテンション、入る " ? " ドットの後、たとえば cust...