Skip to content
Timur Sağlam edited this page May 23, 2018 · 28 revisions

The Extraction Properties

The properties file user.properties can be loaded, accessed, changed and saved with the class ExtractionProperties.

The Properties File

The standard properties file user.properties of the project can be accessed with the class ExtractionProperties. It offers the following properties (with the notation PropertyName = Value1 | Value2):

Basic:

  • CustomExtractionScope = true | false: Determines if the prototypical scope selection UI is shown (see 7. Scope Selection).
  • SavingStrategy = NewProject | OriginalProject | CopyProject | ExistingProject | CustomPath: Determines the saving strategy. Can be set to a custom strategy if it is implemented correctly.
  • GenerateDummyClass = true | false: Determines if there will be an empty dummy class in the default package.
  • DummyClassName = DUMMY: Determines how the dummy class is named. Can be set to any value that could be a class name.
  • GenerateRootContainer = true | false: Determines if there will be an root container element in the default package with a multi reference to EObject.
  • RootContainerName = ROOT: Determines how the root container element is named. Can be set to any value that could be a class name.
  • ProjectSuffix = Model: Is used by some saving strategies to name the target project. Can be set to any value that could be part of an Eclipse project name.

Packages:

  • DefaultPackageName = DEFAULT: Determines how the default package is named. Can be set to any value that could be a package name.
  • DataTypePackageName = DATATYPES: Determines how the data type package is named. Can be set to any value that could be a package name.
  • NestedTypePackageSuffix = InnerTypes: Determines what suffix should be added to the package names of inner type packages. The package names will be OuterTypeName + NestedTypePackageSuffix. Can be set to any value.
  • ExtractEmptyPackages = true | false: Determines if empty packages get extracted.

Types:

  • ExtractNestedTypes = true | false: Determines if nested types get extracted as normal ones (with the naming scheme OuterType#InnerType) or not at all.
  • ExtractClasses = true | false: Determines if classes get extracted.
  • ExtractInterfaces = true | false: Determines if interfaces get extracted.
  • ExtractEnumerations = true | false: Determines if enumerations get extracted.
  • ExtractThrowables = true | false: Determines if classes that inherit from java.lang.Throwable get extracted.

Methods:

  • ReturnTypeMultiplicities = true | false: Determines if one-to-many multiplicities are used to represent method return types of type java.util.List (see 6. Multiplicities).
  • ParameterMultiplicities = true | false: Determines if one-to-many multiplicities are used to represent method parameters of type java.util.List (see 6. Multiplicities).
  • ExtractStaticMethods = true | false: Determines if static methods get extracted as normal ones or not at all.
  • ExtractDefaultMethods = true | false: Determines if methods without access level modifier gets extracted as normal ones or not at all.
  • ExtractPublicMethods = true | false: Determines if public methods get extracted.
  • ExtractProtectedMethods = true | false: Determines if protected methods get extracted as normal ones or not at all.
  • ExtractPrivateMethods = true | false: Determines if private methods get extracted as normal ones or not at all.
  • ExtractAbstractMethods = true | false: Determines if abstract methods get extracted as normal method or not at all.
  • ExtractAccessMethods = true | false: Determines if access methods get extracted or not
  • ExtractConstructors = true | false: Determines if constructors get extracted as normal methods or not at all.

Fields:

  • FieldMultiplicities = true | false: Determines if one-to-many multiplicities are used to represent fields of type java.util.List (see 6. Multiplicities).
  • ExtractStaticFields = true | false: Determines if static fields get extracted as normal ones or not at all.
  • ExtractDefaultFields = true | false: Determines if fields without access level modifier gets extracted as normal ones or not at all.
  • ExtractPublicFields = true | false: Determines if public fields get extracted as normal ones or not at all.
  • ExtractProtectedFields = true | false: Determines if protected fields get extracted as normal ones or not at all.
  • ExtractPrivateFields = true | false: Determines if private fields get extracted.
  • FinalAsUnchangeable = true | false: Determines if final fields are extracted as unchangeable EStructuraFeatures.

The ExtractionProperties Class

If you want to adjust the extraction properties for the session, or if you want to change the properties of the user.properties file programmatically, you can use the class ExtractionProperties. The class automatically loads the user.properties file when creating an instance. If the user.properties file is not available the default property values are used.

The class offers accessors (ExtractionProperties.get()) to access the values of the user.properties file. It also offers mutators (ExtractionProperties.set()) to change values of the user.properties file. In both cases, one has to use the property enumerations to access or change properties. There is one enumeration for text properties (called TextProperty) and another one for binary properties (called BinaryProperty). Both enumerations offer a key and a default value for every enumeral. The key is used in a getter or setter to access the right property from the user.properties. The default value is used if there is no entry in the user.properties file for this specific property. The enumerations make it easy to access the wanted property and also ensure that no invalid properties or property values are set.

If you want to save the changed values to the properties file, you have to call the method save(). If you do not do that, your changes to the properties only are effective during the runtime of the program.

Adding Properties

To add a new property to the project, one has to follow two steps:

  1. Adding a property entry to the user.properties file. For a property name "MyProperty" with the value "MyValue", the entry is:
MyProperty=MyValue
  1. Adding a new enumeral to one of the property enumerations in the package eme.properties to specify the key and the default value of the new property. Choose the enumeration TextProperty for String values and the enumeration BinaryProperty for boolean values. For a property name "MyProperty" with the default value "MyDefaultValue" the enumeral should be:
MY_PROPERTY("MyProperty", "MyDefaultValue")`