How to create Bookmark in skeleton JET [message #900486] |
Tue, 07 August 2012 09:33 |
Eclipse User |
|
|
|
Hi Experts,
I have created skeleton where I have a lot of fields. Let's assume I have field
String CLASSNAME = "my_name";
I would like to change the name of this variable in my .jettxt file. How can I do it?
It should be like: ???? CLASSNAME="NEWCLASSNAME" ?????
Thank you in advance
[Updated on: Tue, 07 August 2012 09:47] by Moderator Report message to a moderator
|
|
|
|
Re: How to create Bookmark in skeleton [message #900513 is a reply to message #900510] |
Tue, 07 August 2012 10:49 |
Eclipse User |
|
|
|
Hi,
Thank you for your response. I think that the easiest way to explain it will be copy code here.
My skeleton:
@Path("/ProposalREST")
public class CLASS {
String MyText = "text";
@POST
@Path("/POST")
@Consumes(MediaType.APPLICATION_JSON)
public Response postProposal(Proposal x) {
return Response.status(201).entity("").build();
}
@GET
@Path("/GET")
@Produces(MediaType.APPLICATION_JSON)
public Proposal getProposal(Proposal x) {
return null;
}
@DELETE
@Path("/DELETE")
@Consumes(MediaType.APPLICATION_JSON)
public Response deleteProposal(Proposal x) {
return Response.status(201).entity("").build();
}
@PUT
@Path("/PUT")
@Consumes(MediaType.APPLICATION_JSON)
public Response putProposal(Proposal x) {
return Response.status(201).entity("").build();
}
public String dummy() {
}
}
And my jettxt file:
<%@
jet package="REST"
imports="import javax.ws.rs.Path javax.ws.rs.GET javax.ws.rs.Produces javax.ws.rs.core.MediaType
javax.ws.rs.POST javax.ws.rs.core.Response javax.ws.rs.DELETE javax.ws.rs.PUT javax.ws.rs.Consumes"
class="Proposal"
skeleton="rest.skeleton"
%>
In skeleton I have got MyText variable. I want to substitute name of this variable in jettxt file.
Do you know what I mean?
[Updated on: Tue, 07 August 2012 10:49] by Moderator Report message to a moderator
|
|
|
|
Re: How to create Bookmark in skeleton [message #900526 is a reply to message #900517] |
Tue, 07 August 2012 11:49 |
Eclipse User |
|
|
|
But for example I have CLASS in skeleton and in my jettxt file I have and after build it is changed. So probably it is possible...
Maybe from another side, I would like to create JET project which generate for me code like this:
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/YourClassRest")
public class YourClassRest {
@POST
@Path("/POST")
@Consumes(MediaType.APPLICATION_JSON)
public Response postYourClass(YourClass x) {
return Response.status(201).entity("").build();
};
@GET
@Path("/GET")
@Produces(MediaType.APPLICATION_JSON)
public YourClass getYourClass(YourClass x) {
return null;
};
@PUT
@Path("/PUT")
@Consumes(MediaType.APPLICATION_JSON)
public Response putYourClass(YourClass x) {
return Response.status(201).entity("").build();
}
@DELETE
@Path("/DELETE")
public void deleteYourClass(YourClass x) {
};
}
And I can give the name of YourClass. How can I do it?
|
|
|
|
|
Re: How to create Bookmark in skeleton [message #900664 is a reply to message #900532] |
Wed, 08 August 2012 06:08 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Aleksander,
You need templates. Did you have a look at EMF templates? Did you read
the tutorial?
On 07/08/2012 2:21 PM, ALeksander Sadecki wrote:
> Ok, thanks. So, I do not have to use template. I can do it in another
> way but I have no idea how. Is it possible to generate a method for
> Java Class without skeletons?
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04761 seconds