Skip Headers

# Using Java

Previous

Next

Create a descriptor amendment method ("Configuring Amendment Methods") to customize the root class descriptor's `InheritancePolicy` using `InheritancePolicy` methods `setParentClass`, `setClassIndicatorFieldName`, `addClassIndicator`, `useClassNameAsIndicator` and `setClassExtractionMethodName`, as required.

Example: Configuring Only-Instances Expressions shows amendment methods for the `Person` and `Student` classes where `Student` extends `Person` in a relational project. In this example, a class indicator field is used (see "Using Class Indicator Fields").

Configuring Inheritance for a Relational Root Class

    ...
    public static void addToPersonDescriptor(Descriptor descriptor) {
        descriptor.getInheritancePolicy().setClassIndicatorFieldName("CLIENT_TYPE");
        descriptor.getInheritancePolicy().addClassIndicator("P");
    }

    public static void addToStudentDescriptor(Descriptor descriptor) {
        descriptor.getInheritancePolicy().setParentClass(Person.class);
        descriptor.getInheritancePolicy().setClassIndicatorFieldName("CLIENT_TYPE");
        descriptor.getInheritancePolicy().addClassIndicator("S");
    }
    ...

If you are using a class-extraction method (see "Using Class Extraction Methods"), you may also need to use `InheritancePolicy` methods `setOnlyInstancesExpression` and `setWithAllSubclassesExpression` (see "Configuring Inheritance Expressions for a Parent (Root) Class Descriptor").

Example: Configuring Only-Instances Expressions shows amendment methods for the `Person` and `Student` classes where `Student` extends `Person` in an EIS project using XML records. In this example, a class indicator field is used (see "Using Class Indicator Fields").

Configuring Inheritance for an EIS Root Class

    ...
    public static void addToPersonDescriptor(Descriptor descriptor) {
        descriptor.getInheritancePolicy().setClassIndicatorField(
            new XMLField("@CLIENT_TYPE")
        );
        descriptor.getInheritancePolicy().addClassIndicator("P");
    }

    public static void addToStudentDescriptor(Descriptor descriptor) {
        descriptor.getInheritancePolicy().setParentClass(Person.class);
        descriptor.getInheritancePolicy().setClassIndicatorField(
            new XMLField("@CLIENT_TYPE")
        );
        descriptor.getInheritancePolicy().addClassIndicator("S");
    }
    ...