Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/seldridge/reflective-builder

A demonstration of a Scala utility for reflectively building other Scala classes
https://github.com/seldridge/reflective-builder

Last synced: about 1 month ago
JSON representation

A demonstration of a Scala utility for reflectively building other Scala classes

Awesome Lists containing this project

README

        

This is a standalone utility for evaluating Scala code reflectively. Think Python's [`eval()`](https://www.programiz.com/python-programming/methods/built-in/eval).

This works by using Java reflection to try to construct an object from a class
name that you give it. It then executes a method of that class with provided
arguments.

Example usage:

```
# scala-cli ReflectiveBuilder.scala --main-class ReflectiveBuilder --extra-jars /target/scala-2.13/classes -- --object 'foo.bar.Baz' --method apply --argument 'foo.bar$Qux(42, true)'
```