International-Data-Spaces-Association / Java-Representation-of-IDS-Information-Model

Apache License 2.0
2 stars 6 forks source link

Feature Request: Interface for Builder classes #1

Open brianjahnke opened 3 years ago

brianjahnke commented 3 years ago

Hi,

all builder classes share common properties, e.g. the constructor or build function.

final public AccessTokenRequestMessage build() throws ConstraintViolationException {      
    VocabUtil.getInstance().validate(accessTokenRequestMessageImpl);
    return accessTokenRequestMessageImpl;
}

I would like to propose a common interface used for all Builder classes.

Something like

public interface Builder<T>{
    T build() throws ConstraintViolationException;
}

By using this interface it would be possible to use the builder independent from the concrete type they are constructing. This independence would mean it would be possible to implement common interactions such as error handling in a generic way.

maboeckmann commented 3 years ago

Hi Brian,

thank you for submitting this feature request. My apologies for not replying for so long, but please be assured that we already have taken this suggestion into consideration. We have created such an interface and it will be included in the next larger update of our libraries (current time plan: 3 weeks from now).