m-m-m / code

Library to parse, analyze, transform and generate code
Apache License 2.0
2 stars 3 forks source link

Add CodeContext.getOrCreateType(String fqn, boolean add) #15

Closed hohwille closed 5 years ago

hohwille commented 5 years ago

We have the ability to get a type by fqn or Class. It is also possible to create a type on the fly but this is rather tricky to do:

context.getSource().getRootPackage().getChildren().getOrCreateFile(path, add, init).getType()

No beginner will be able to figure out such API call by himself easily. It would therefore be nice to have a method CodeContext.getOrCreateType(String fqn, boolean add).

hohwille commented 5 years ago

Done.