MPS 2026.1 ヘルプ

BaseLanguage のプロパティ

プロパティは、 getter および setter とともにプライベートフィールドを使用して BaseLanguage クラスを強化するためのショートカットを提供します。

特性の説明

Properties are part of BaseLanguage itself, so no additional import is necessary. They are supposed to be created as class members alongside fields and methods.

Property example

プロパティは以下を定義します。

  • 可視性。getter の可視性として使用されます。

  • 型 - プロパティによって格納される値の型、getter の戻り値の型、および setter の単一パラメーターの型を示します。

  • Getter - 'default' (暗黙的) でプロパティ値を返すことも、明示的に返すこともできます。

  • Setter - 読み取り専用プロパティの場合は「none」にすることができ、'default' はプロパティの値を単に設定するか、明示的に設定します。

プロパティの編集

新しいプロパティを挿入すると、通常はデフォルトの getter とプライベートのデフォルト setter で始まります。

Default property definition

Pressing Enter on the getter will create an explicit getter for you to insert the code and the setter will be removed (read-only property). The setter can be provided by pressing Enter in the setter region.

Property with an explicit getter

Pressing Enter on the setter, instead, will keep a default getter and create an explicit setter.

Property with explicit setter

Regardless of the situation, you can always delete an explicit getter or setter with Delete and create them with Enter.

Property with both getter and a setter

getter および setter では、2 つの特別な式が使用できます。

  • value - setter のパラメーターを参照します

  • 実際のプロパティ名 - setter と getter の両方の現在のプロパティ値を指します。

プロパティを getter および setter のフィールドに変換したり、その逆に変換したりするために、2 つのインテンション / リファクタリングが使用できます。

Property refactorings
2026 年 5 月 06 日