-
-
Save linyatis/4b65467b2b20cccb98d0 to your computer and use it in GitHub Desktop.
Problema com converter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Farm { | |
| private Long id; | |
| private String name; | |
| private Polygon perimeter; | |
| public Farm() { | |
| } | |
| public Long getId() { | |
| return id; | |
| } | |
| public void setId(Long id) { | |
| this.id = id; | |
| } | |
| public String getName() { | |
| return name; | |
| } | |
| public void setName(String name) { | |
| this.name = name; | |
| } | |
| public Polygon getPerimeter() { | |
| return perimeter; | |
| } | |
| public void setPerimeter(Polygon perimeter) { | |
| this.perimeter = perimeter; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import javax.inject.Inject; | |
| import br.com.agrofficio.kpifarm.annotation.Security; | |
| import br.com.agrofficio.kpifarm.model.Farm; | |
| import br.com.caelum.vraptor.Consumes; | |
| import br.com.caelum.vraptor.Controller; | |
| import br.com.caelum.vraptor.Path; | |
| import br.com.caelum.vraptor.Post; | |
| import br.com.caelum.vraptor.Result; | |
| import br.com.caelum.vraptor.view.Results; | |
| @Controller | |
| @Path("/api/client/farms") | |
| public class FarmController { | |
| @Inject | |
| private Result result; | |
| public FarmController() { | |
| } | |
| @Post("") | |
| @Consumes("application/json") | |
| public void add(Farm data) { | |
| result.use(Results.json()).from(data).recursive().serialize(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import javax.annotation.Priority; | |
| import javax.enterprise.context.RequestScoped; | |
| import javax.enterprise.inject.Alternative; | |
| import javax.interceptor.Interceptor; | |
| import br.com.caelum.vraptor.Convert; | |
| import br.com.caelum.vraptor.converter.Converter; | |
| import com.vividsolutions.jts.geom.Polygon; | |
| @Convert(Polygon.class) | |
| public class PolygonConverter implements Converter<Polygon> { | |
| @Override | |
| public Polygon convert(String value, Class<? extends Polygon> type) { | |
| return null; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment