Skip to content

Commit

Permalink
feat: add invoke method on Prop to enable Kotlin invocation usage (#35)
Browse files Browse the repository at this point in the history
* Add invoke method on Prop to enable Kotlin invocation usage

* Bump and add CHANGELOG entry

* Or don't
  • Loading branch information
erwinw committed Apr 15, 2021
1 parent 82dcb32 commit 9bb67bf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public T get() {
return archaiusProperty.getValue();
}

@Override
public T invoke() {
return get();
}

@Override
public String getName() {
return archaiusProperty.getName();
Expand Down
6 changes: 6 additions & 0 deletions prop-core/src/main/java/io/pleo/prop/core/Prop.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ public interface Prop<T> extends Supplier<T> {
*/
String getName();

/**
* Kotlin convenience method to implement invocation
* @return the property value
*/
T invoke();

/**
* Gets the time when the property was last set/changed.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public T get() {
return supplier.get();
}

@Override
public T invoke() {
return get();
}

@Override
public String getName() {
return toString();
Expand Down

0 comments on commit 9bb67bf

Please sign in to comment.