Package org.codehaus.jackson.type

Examples of org.codehaus.jackson.type.TypeReference


    // TODO, assume the url is a file path for now.
    java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl);
    try {
      ObjectMapper om = new ObjectMapper();
      TypeReference readType = new TypeReference<HashMap<String, Object>>() {
      };
      Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType);
      Boolean oldValue = (Boolean) prefs.get("allow-anonymous-usage-tracking");
      // If value changed, write it to the file too
      if ((this.isAllowAnonymousTracking == null && oldValue != null)
View Full Code Here


    // TODO, assume the url is a file path for now.
    java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl);
    try {
      ObjectMapper om = new ObjectMapper();
      TypeReference readType = new TypeReference<HashMap<String, Object>>() {
      };
      Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType);
      Boolean oldValue = (Boolean) prefs.get("advanced-mode");
      // If value changed, write it to the file too
      if ((this.isUseAdvancedMode == null && oldValue != null)
View Full Code Here

    @Test
    public void CollectionReadTest() {
        ObjectMapper mapper = new ObjectMapper();
        Map<Integer, Movie> movieMap = new HashMap<>();
        TypeReference thisMap = new TypeReference<Map<Integer, Movie>>() {};
        ResponseEntity<String> r = rest.getForEntity(rootURL + "/example/movies/", String.class, "");
        assertEquals(r.getStatusCode(), HttpStatus.OK);

        try {
            movieMap = mapper.readValue(r.getBody(), thisMap);
View Full Code Here

    @Test
    public void ItemReadTest() {
        ObjectMapper mapper = new ObjectMapper();
        Movie m = new Movie();
        TypeReference thisElement = new TypeReference<Movie>() {};
        ResponseEntity<String> r = rest.getForEntity(rootURL + "/example/movies/2", String.class, "");
        assertEquals(r.getStatusCode(), HttpStatus.OK);

        try {
            m = mapper.readValue(r.getBody(), thisElement);
View Full Code Here

        rest.put(rootURL + "/example/movies/Kill Bill Volume 2/pg16/Quentin Tarantino",null);
        ObjectMapper mapper = new ObjectMapper();

        // Check that it is actually there.
        Movie m = new Movie();
        TypeReference thisElement = new TypeReference<Movie>() {};
        ResponseEntity<String> r = rest.getForEntity(rootURL + "/example/movies/3", String.class, "");
        assertEquals(r.getStatusCode(), HttpStatus.OK);

        try {
            m = mapper.readValue(r.getBody(), thisElement);
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.type.TypeReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.