Skip to content

Why is there no publishPhysicalAssetWldtEvent but only the Property, Action, Event, Relationships options? #18

Description

@samubura

It seems strange to me that I have to resort to the specific version of the method for each type if they can have a common base class that can be used and no difference in the implementation.

The methods:

protected void publishPhysicalAssetPropertyWldtEvent(PhysicalAssetPropertyWldtEvent<?> targetPhysicalPropertyEventMessage) throws EventBusException {
        WldtEventBus.getInstance().publishEvent(this.digitalTwinId, this.getId(), targetPhysicalPropertyEventMessage);
    }

    protected void publishPhysicalAssetEventWldtEvent(PhysicalAssetEventWldtEvent<?> targetPhysicalAssetEventWldtEvent) throws EventBusException {
        WldtEventBus.getInstance().publishEvent(this.digitalTwinId, this.getId(), targetPhysicalAssetEventWldtEvent);
    }

    protected void publishPhysicalAssetRelationshipCreatedWldtEvent(PhysicalAssetRelationshipInstanceCreatedWldtEvent<?> targetPhysicalAssetRelationshipWldtEvent) throws EventBusException {
        WldtEventBus.getInstance().publishEvent(this.digitalTwinId, this.getId(), targetPhysicalAssetRelationshipWldtEvent);
    }

    protected void publishPhysicalAssetRelationshipDeletedWldtEvent(PhysicalAssetRelationshipInstanceDeletedWldtEvent<?> targetPhysicalAssetRelationshipWldtEvent) throws EventBusException {
        WldtEventBus.getInstance().publishEvent(this.digitalTwinId, this.getId(), targetPhysicalAssetRelationshipWldtEvent);
    }

are all the same, we could simplify with only one method for the Physical Adapters.

This would enable the publishing of a generic event without knowing in advance its type which might come in handy for some situations.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions