Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handling of sealed abstract class #42

Closed
pjfanning opened this issue Sep 11, 2022 · 2 comments
Closed

handling of sealed abstract class #42

pjfanning opened this issue Sep 11, 2022 · 2 comments

Comments

@pjfanning
Copy link
Contributor

pjfanning commented Sep 11, 2022

In the code sample, below it would be great if this lib could produce an RType for the Animal class that exposes the 'children' sub types in a similar way to how SealedTraitInfo works.

sealed abstract class Animal {
  val name: String
  val animalType: String = "Animal"
}

class Dog(val name: String) extends Animal {
  override val animalType: String = "Dog"
}

class Cat(val name: String) extends Animal {
  override val animalType: String = "Cat"
}

Currently RType.of(classOf[Animal]) returns:

ScalaClassInfo(com.github.pjfanning.jackson.reflection.annotated.Animal):
   fields:
   non-constructor fields:
   annotations:
@pjfanning pjfanning changed the title handling of sealead handling of sealed abstract class Sep 11, 2022
@pjfanning
Copy link
Contributor Author

I have a fix for this in https://github.com/pjfanning/scala3-reflection v1.2.0 release

@gzoller
Copy link
Owner

gzoller commented Nov 12, 2022

Rolled pfjanning's fix into feature branch. Will be available in next release. Sorry for the delay! Caught up in work.

@gzoller gzoller closed this as completed Nov 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants