Skip to content

Commit

Permalink
Merge pull request #543 from commercetools/Make_TypeSelector_public
Browse files Browse the repository at this point in the history
Make TypeSelector constructor public, so it's easier to provide custom TypeSelectors
  • Loading branch information
benko-balog authored Oct 18, 2023
2 parents 182b988 + 17372af commit 027d36c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ package object generic extends Logging {
def mongoTypeSwitch[T: ClassTag, ${implTypeParams}](selectors: List[TypeSelector[_]]): MongoFormat[T] = mongoTypeSwitch[T, ${typeParams}](typeSelector[A${i}]() :: selectors)
</#list>

final class TypeSelector[A: MongoFormat] private[mongo](val typeValue: String, val clazz: Class[_]) {
final class TypeSelector[A: MongoFormat](val typeValue: String, val clazz: Class[_]) {
def read(any: Any): A = fromMongo[A](any)
def write(a: Any): Any = toMongo[A](a.asInstanceOf[A])
}
Expand Down

0 comments on commit 027d36c

Please sign in to comment.