javapoet Questions
1
I want to create method level annotations & generate code for it. I want to avoid using AspectJ and would prefer a compile time code generator so that if I've to ever debug the code I can actua...
Chamfer asked 9/3 at 17:33
1
I've built an annotation processor for my Android project that builds a source file using JavaPoet. However, every time I need to call addModifiers on any JavaPoet object, Android Studio flags it a...
Descombes asked 26/9, 2015 at 20:11
3
Solved
Attempting to implement the basic JavaPoet example (see below) in a Android ActivityWatcher class from LeakCanary:
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
The Modifier.PUBLIC and Modifie...
0
I was playing around with annotation processing and was unable to use generated files directly via an import in my code. Instead I had to prepend the generated class with its complete package. I po...
Estuary asked 1/7, 2019 at 7:27
1
Solved
In my Android Application I have an annotation processor which generates files using JavaPoet and places them under the package generated.schema.
The files are generating correctly. Whenever I use...
Kalikalian asked 21/6, 2019 at 6:36
1
I have been experimenting with code generation in an annotation processor.
Consider the following piece of code that adds a constructor that has a statement in it.
private void addRegister(Execut...
Dollarbird asked 27/4, 2015 at 20:47
2
i want to generate a field like this:
public static Map<String, Class<?>> ID_MAP = new HashMap<String, Class<?>>();
WildcardTypeName.subtypeOf(Object.class) can give '?'
...
Roundhead asked 9/11, 2016 at 14:52
1
Solved
I am trying to add an inner class (e.g. interface Listener{}) to a TypeSpec. Also I want to add a field of type Listener to my TypeSpec. How could i achieve something like that?
TypeSpec outerClas...
1
Hey I'm trying to generate a class like this:
public abstract class ResourceListAdapter<T extends ResourceViewHolder> extends RecyclerView.Adapter<T> {}
At the moment I can generate:
p...
1
Solved
I'm working on a annotation processor written in java. I'm using JavaPoet to generate some lines of code. I have to generate a 'switch' statement. Now i'm using the following code:
MethodSpec.Buil...
2
Solved
How would I generate a method with the following signature?
public <T extends MyClass> void doSomething(T t)
So far I have:
MethodSpec.methodBuilder("doSomething")
.addModifiers(Modifier...
Steelyard asked 21/6, 2015 at 22:32
1
Solved
Anyone know how I can do the following using javapoet
public class MyClassGenerated extends MyMapper<OtherClass>{
}
My code of generation:
TypeSpec generateClass() {
return classBuilder...
2
Using Javapoet, how to implement the following:
class A extends class B
class C implements Interface D
In the javadoc, it is mentioned how to create interfaces.
1
Solved
Is there a any way to generate inner classes in javapoet library. I can generate classes with constructors and methods. But i can't figure out how to create inner classes
Spartacus asked 14/12, 2015 at 15:59
1
Solved
I am writing a code generator using JavaPoet and need to put an annotation on a class
For example :
@RequestMapping("/api")
public class SomeResource {
// rest of the code elided
}
I am able t...
Enfranchise asked 1/9, 2015 at 10:20
1
Solved
I am writing a code generator using JavaPoet and need to put an annotation on the class
For example :
package some.package
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax...
Wesleywesleyan asked 25/8, 2015 at 3:29
1
Solved
I'm generating code with JavaPoet.
Somewhere in the generated code I want to add a method which has the following argument.
...
public B someMethod(final AbstractObjectBuilder<Persoon,?> b...
Unfolded asked 18/3, 2015 at 8:44
1
© 2022 - 2024 — McMap. All rights reserved.