ClosestExtFieldsCollisionHandler

This class is used in creating the cube selection. It is used to improve the collision handler feature.

Here is the basic usage sample:

IDatastoreSchemaDescription description;
ISelectionDescription selection = StartBuilding.selection(description)
        .fromBaseStore("BaseStore")
        .withAllReachableFields(ClosestExtFieldsCollisionHandler.INSTANCE)
        .build();

The collision handler resolves the duplicate field issue on the selection. By default, the field name is the store field name.

Compared to the core collision handler, this handler:

  • uses the field with the shortest path.
  • renames the collided fields if they are at the same level, by default the new name will be “reference_field”.
  • uses specific configuration rules.

This collision handler has several configuration methods that can be called in a fluent way.

API

Method Fields Meaning
withAlias fieldPath, alias Set a naming rule for a field path. If found, this field will be given the name set as the alias.
withReferenceAlias referenceName, alias Renames a reference to another alias name. This is used in case of a conflict in renaming the collided fields.

Examples

Default behavior

  • /TestBaseToTradeAttributes/TradeAttributesToCounterparties/Stuff => TradeAttributesToCounterparties_Stuff
  • /TestBaseToTradeAttributes/TradeAttributesToBookHierarchy/Stuff => TradeAttributesToBookHierarchy_Stuff

withAlias

withAlias("TradeAttributesToCounterparties/Stuff", "C_Stuff")

  • /TestBaseToTradeAttributes/TradeAttributesToCounterparties/Stuff => C_Stuff
  • /TestBaseToTradeAttributes/TradeAttributesToBookHierarchy/Stuff => Stuff

withAlias("Book", "MyBook")

  • /TestBaseToTradeAttributes/TradeAttributesToBookHierarchy/Book => Book
  • /Book => MyBook

withReferenceAlias

withReferenceAlias("TradeAttributesToBookHierarchy", "Book")

  • /TestBaseToTradeAttributes/TradeAttributesToCounterparties/Stuff => TradeAttributesToCounterparties_Stuff
  • /TestBaseToTradeAttributes/TradeAttributesToBookHierarchy/Stuff => Book_Stuff