Questions tagged [sun-codemodel]

CodeModel is a Java library for code generators.

CodeModel provides a way to generate Java programs in a way much nicer than PrintStream.println().

This project is a spin-off from the Reference Implementation for its schema compiler to generate Java source files. http://codemodel.java.net/

81 questions
0
votes
1 answer

compare two objects with codeModel

I have the following code but I'm trying to not use the direct() method. JExpression jx = JExpr.direct("java.lang.Thread.currentThread() == android.os.Looper.getMainLooper().getThread()"); I have tried finding documentation on using _if() I was…
Rocky Pulley
  • 22,531
  • 20
  • 68
  • 106
0
votes
1 answer

For generating programs there is " CodeModel API" in java, like is there any API for Objective-C?

I Want to generate A simple "Hello World" objective-C program, Which API i have to use for that? Really I don't know is it possible or not?, but in java I know there is CodeModel API. JCodeModel cm = new JCodeModel(); JDefinedClass class1 =…
0
votes
1 answer

replace variable usage with method in codemodel

I'm searching for a solution where I can define a field in a class and use the reference in this particular class. The codemodel should create a method for instantiating the field and should replace the field usages with the created method. I hope…
alosdev
  • 384
  • 2
  • 14
0
votes
1 answer

How do I remove unnecessary brackets using CodeModel's JExpr.plus method?

I'm using JExpr.plus() method to form a String and syntactically it is correct, but it has a lot of brackets. For example: JExpr.lit("ONE").plus(JExpr.lit("TWO")).plus(JExpr.lit("THREE")) returns (("ONE" + "TWO") + "THREE") and I would like it to…
Gorayni
  • 606
  • 2
  • 8
  • 26
0
votes
1 answer

Use sun-codemodel to generate expression like b().c()

I'm trying to use sun-codemodel to generate source code, checking the API for a long time however no luck. JBlock body2 = method2.body(); JInvocation arg = body2.invoke( "a" ).arg( xxx ).invoke( "c" ).arg( xxx ); only generate the first part,…
Mike
  • 3,515
  • 10
  • 44
  • 67
-1
votes
1 answer

How to generate int field with hex constant vale with codeModel

I am attempting to generate java enums using compile group: 'com.sun.codemodel', name: 'codemodel', version: '2.6' Each enum constant has two int arguments that must be set to hex/unicode values. The code I wish to generate will resemble…
Hector
  • 4,016
  • 21
  • 112
  • 211
1 2 3 4 5
6