Skip to content

Commit

Permalink
Removed dependency injection type since it is a custom type. In our p…
Browse files Browse the repository at this point in the history
…roject we are now using a CodeReference, but represented these models as a JSON blob. This JSON is then deserialized in the custom pages we have for this.

This method helps further clarify these stat types.
  • Loading branch information
handstandsam committed Nov 13, 2024
1 parent 1329b80 commit 848167a
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ object InvertSerialization {
actualClass = Stat.NumericStat::class,
actualSerializer = Stat.NumericStat.serializer()
)
polymorphic(
baseClass = Stat::class,
actualClass = Stat.DiProvidesAndInjectsStat::class,
actualSerializer = Stat.DiProvidesAndInjectsStat.serializer()
)
polymorphic(
baseClass = Stat::class,
actualClass = Stat.CodeReferencesStat::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,44 +47,4 @@ sealed interface Stat {
val owner: OwnerName? = null,
)
}

@Serializable
@SerialName("di_provides_and_injects")
data class DiProvidesAndInjectsStat(
val value: List<ProvidesAndInjects>,
val details: String? = null,
) : Stat {
/**
* Represents the data in an Anvil ContributesBinding Annotation Usage
*/
@Serializable
data class DiContribution(
val annotation: String,
val scope: String,
val boundImplementation: String,
val boundType: String,
val replaces: List<String>,
)

/**
* Represents the data in an Anvil ContributesBinding Annotation Usage
*/
@Serializable
data class DiInjection(
val type: String,
val qualifierAnnotations: List<String>,
val startLine: Int,
val endLine: Int,
)

@Serializable
data class ProvidesAndInjects(
val classFqName: String,
val contributions: List<DiContribution>,
val consumptions: List<DiInjection>,
val filePath: String,
val startLine: Int,
val endLine: Int,
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ enum class StatDataType(
BOOLEAN(Boolean::class),
NUMERIC(Long::class),
STRING(String::class),
CODE_REFERENCES(Stat.CodeReferencesStat.CodeReference::class), // EXPLORE (CUSTOM)
DI_PROVIDES_AND_INJECTS(Stat.DiProvidesAndInjectsStat::class); // EXPLORE (CUSTOM)
CODE_REFERENCES(Stat.CodeReferencesStat.CodeReference::class);

companion object {
fun fromString(type: String?): StatDataType? {
Expand All @@ -23,7 +22,6 @@ enum class StatDataType(
NUMERIC -> "Numeric"
STRING -> "String"
CODE_REFERENCES -> "Code References"
DI_PROVIDES_AND_INJECTS -> "DI Provides and Injects"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ fun AllStatsComposable(
headers = listOf("Key", "Description", "Type", "Category", "Count"),
maxResultsLimitConstant = PagingConstants.MAX_RESULTS,
rows = stats
.filter { it.dataType != StatDataType.STRING && it.dataType != StatDataType.DI_PROVIDES_AND_INJECTS }
.filter { it.dataType != StatDataType.STRING }
.map { statMetadata ->
mutableListOf<String>(
statMetadata.key,
Expand Down

0 comments on commit 848167a

Please sign in to comment.