scalecube-config icon indicating copy to clipboard operation
scalecube-config copied to clipboard

Support interface property instead required implementation

Open segabriel opened this issue 7 years ago • 0 comments

It will be nice to support an interface (without any implementation) as ObjectProperty, and use java8 interface features. For example, the next interface:

interface ObjectProperty {
 
    Integer testProperty();

    Optional<Integer> testOptionalProperty();

    default String testDefaultProperty() {
      return "DEFAULT";
    }

    default Optional<String> testOptionalDefaultProperty() {
      return Optional.of("DEFAULT");
    }
  }

and then with ConfigRegistry :

   ObjectConfigProperty<ObjectProperty> settings = config.objectProperty(mapping, ObjectProperty.class);

Note: mapping on interface method name

segabriel avatar Jul 31 '18 15:07 segabriel