Skip to content

Commit

Permalink
feat(common-enums): add common ValueEnum interface
Browse files Browse the repository at this point in the history
This interface exposes a common `value` property such that abstractions
can be made on top of this interface, rather than requiring the concrete
enum class.
  • Loading branch information
EdricChan03 committed May 10, 2024
1 parent c1f095f commit 5973982
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions androidx/common/common-enums/api/common-enums.api
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ public abstract class io/github/edricchan03/androidx/common/enums/EnumFromValue
public final fun requireValue (Ljava/lang/Object;)Ljava/lang/Enum;
}

public abstract interface class io/github/edricchan03/androidx/common/enums/ValueEnum {
public abstract fun getValue ()Ljava/lang/Object;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.github.edricchan03.androidx.common.enums

/**
* Interface which [Enum]s should implement to indicate that
* they support the [EnumFromValue] specification.
* @since 0.2.0
*/
public interface ValueEnum<T> {
/**
* The underlying internal value.
* @since 0.2.0
*/
public val value: T
}

0 comments on commit 5973982

Please sign in to comment.