欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

java的Jackson框架實(shí)現(xiàn)輕易轉(zhuǎn)換JSON

 更新時(shí)間:2017年02月08日 15:04:20   作者:hoojo  
本篇文章主要介紹了java的Jackson框架實(shí)現(xiàn)輕易轉(zhuǎn)換JSON,Jackson將Java對象轉(zhuǎn)換成json對象和xml文檔,同樣也可以將json、xml轉(zhuǎn)換成Java對象,有興趣的可以了解一下。

Jackson可以輕松的將Java對象轉(zhuǎn)換成json對象和xml文檔,同樣也可以將json、xml轉(zhuǎn)換成Java對象。

相比json-lib框架,Jackson所依賴的jar包較少,簡單易用并且性能也要相對高些。而且Jackson社區(qū)相對比較活躍,更新速度也比較快。

一、準(zhǔn)備工作

1、 下載依賴庫jar包

Jackson的jar all下載地址:http://jackson.codehaus.org/1.7.6/jackson-all-1.7.6.jar

然后在工程中導(dǎo)入這個jar包即可開始工作

官方示例:http://wiki.fasterxml.com/JacksonInFiveMinutes

因?yàn)橄旅娴某绦蚴怯胘unit測試用例運(yùn)行的,所以還得添加junit的jar包。版本是junit-4.2.8

如果你需要轉(zhuǎn)換xml,那么還需要stax2-api.jar

2、 測試類基本代碼如下

package com.hoo.test;
 
import java.io.IOException;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.codehaus.jackson.JsonEncoding;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.node.JsonNodeFactory;
import org.codehaus.jackson.xml.XmlMapper;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.hoo.entity.AccountBean;
 
/**
 * <b>function:</b>Jackson 將java對象轉(zhuǎn)換成JSON字符串,也可以將JSON字符串轉(zhuǎn)換成java對象
 * jar-lib-version: jackson-all-1.6.2
 * jettison-1.0.1
 * @author hoojo
 * @file JacksonTest.java
 * @package com.hoo.test
 * @project Spring3
 * @version 1.0
 */
@SuppressWarnings("unchecked")
public class JacksonTest {
  private JsonGenerator jsonGenerator = null;
  private ObjectMapper objectMapper = null;
  private AccountBean bean = null;
  
  @Before
  public void init() {
    bean = new AccountBean();
    bean.setAddress("china-Guangzhou");
    bean.setEmail("hoojo_@126.com");
    bean.setId(1);
    bean.setName("hoojo");
    
    objectMapper = new ObjectMapper();
    try {
      jsonGenerator = objectMapper.getJsonFactory().createJsonGenerator(System.out, JsonEncoding.UTF8);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  
  @After
  public void destory() {
    try {
      if (jsonGenerator != null) {
        jsonGenerator.flush();
      }
      if (!jsonGenerator.isClosed()) {
        jsonGenerator.close();
      }
      jsonGenerator = null;
      objectMapper = null;
      bean = null;
      System.gc();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}

3、 所需要的JavaEntity

package com.hoo.entity; 
public class AccountBean {
  private int id;
  private String name;
  private String email;
  private String address;
  private Birthday birthday;
  
  //getter、setter
  
  @Override
  public String toString() {
    return this.name + "#" + this.id + "#" + this.address + "#" + this.birthday + "#" + this.email;
  }
}

Birthday

package com.hoo.entity;
 
public class Birthday {
  private String birthday;
  
  public Birthday(String birthday) {
    super();
    this.birthday = birthday;
  }
 
  //getter、setter
 
  public Birthday() {}
  
  @Override
  public String toString() {
    return this.birthday;
  }
}

二、Java對象轉(zhuǎn)換成JSON

1、 JavaBean(Entity/Model)轉(zhuǎn)換成JSON

/**
 * function:將java對象轉(zhuǎn)換成json字符串
 * @author hoojo
 */
@Test
public void writeEntityJSON() {
  
  try {
    System.out.println("jsonGenerator");
    //writeObject可以轉(zhuǎn)換java對象,eg:JavaBean/Map/List/Array等
    jsonGenerator.writeObject(bean);  
    System.out.println();
    
    System.out.println("ObjectMapper");
    //writeValue具有和writeObject相同的功能
    objectMapper.writeValue(System.out, bean);
  } catch (IOException e) {
    e.printStackTrace();
  }
}

運(yùn)行后結(jié)果如下:

jsonGenerator
{"address":"china-Guangzhou","name":"hoojo","id":1,"birthday":null,"email":"hoojo_@126.com"}
ObjectMapper
{"address":"china-Guangzhou","name":"hoojo","id":1,"birthday":null,"email":hoojo_@126.com}

上面分別利用JsonGenerator的writeObject方法和ObjectMapper的writeValue方法完成對Java對象的轉(zhuǎn)換,二者傳遞的參數(shù)及構(gòu)造的方式不同;JsonGenerator的創(chuàng)建依賴于ObjectMapper對象。也就是說如果你要使用JsonGenerator來轉(zhuǎn)換JSON,那么你必須創(chuàng)建一個ObjectMapper。但是你用ObjectMapper來轉(zhuǎn)換JSON,則不需要JSONGenerator。

objectMapper的writeValue方法可以將一個Java對象轉(zhuǎn)換成JSON。這個方法的參數(shù)一,需要提供一個輸出流,轉(zhuǎn)換后可以通過這個流來輸出轉(zhuǎn)換后的內(nèi)容?;蚴翘峁┮粋€File,將轉(zhuǎn)換后的內(nèi)容寫入到File中。當(dāng)然,這個參數(shù)也可以接收一個JSONGenerator,然后通過JSONGenerator來輸出轉(zhuǎn)換后的信息。第二個參數(shù)是將要被轉(zhuǎn)換的Java對象。如果用三個參數(shù)的方法,那么是一個Config。這個config可以提供一些轉(zhuǎn)換時(shí)的規(guī)則,過指定的Java對象的某些屬性進(jìn)行過濾或轉(zhuǎn)換等。

2、 將Map集合轉(zhuǎn)換成Json字符串

/**
 * <b>function:</b>將map轉(zhuǎn)換成json字符串
 * @author hoojo

 */
@Test
public void writeMapJSON() {
  try {
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("name", bean.getName());
    map.put("account", bean);
    bean = new AccountBean();
    bean.setAddress("china-Beijin");
    bean.setEmail("hoojo@qq.com");
    map.put("account2", bean);
    
    System.out.println("jsonGenerator");
    jsonGenerator.writeObject(map);
    System.out.println("");
    
    System.out.println("objectMapper");
    objectMapper.writeValue(System.out, map);
  } catch (IOException e) {
    e.printStackTrace();
  }
}

轉(zhuǎn)換后結(jié)果如下:

jsonGenerator
{"account2":{"address":"china-Beijin","name":null,"id":0,"birthday":null,"email":"hoojo@qq.com"},"name":"hoojo",
"account":{"address":"china-Guangzhou","name":"hoojo","id":1,"birthday":null,"email":"hoojo_@126.com"}}
objectMapper
{"account2":{"address":"china-Beijin","name":null,"id":0,"birthday":null,"email":"hoojo@qq.com"},"name":"hoojo",
"account":{"address":"china-Guangzhou","name":"hoojo","id":1,"birthday":null,"email":hoojo_@126.com}}

3、 將List集合轉(zhuǎn)換成json

/**
 * <b>function:</b>將list集合轉(zhuǎn)換成json字符串
 * @author hoojo
 */
@Test
public void writeListJSON() {
  try {
    List<AccountBean> list = new ArrayList<AccountBean>();
    list.add(bean);
    
    bean = new AccountBean();
    bean.setId(2);
    bean.setAddress("address2");
    bean.setEmail("email2");
    bean.setName("haha2");
    list.add(bean);
    
    System.out.println("jsonGenerator");
    //list轉(zhuǎn)換成JSON字符串
    jsonGenerator.writeObject(list);
    System.out.println();
    System.out.println("ObjectMapper");
    //用objectMapper直接返回list轉(zhuǎn)換成的JSON字符串
    System.out.println("1###" + objectMapper.writeValueAsString(list));
    System.out.print("2###");
    //objectMapper list轉(zhuǎn)換成JSON字符串
    objectMapper.writeValue(System.out, list);
  } catch (IOException e) {
    e.printStackTrace();
  }
}

結(jié)果如下:

jsonGenerator
[{"address":"china-Guangzhou","name":"hoojo","id":1,"birthday":null,"email":"hoojo_@126.com"},
{"address":"address2","name":"haha2","id":2,"birthday":null,"email":"email2"}]
ObjectMapper
1###[{"address":"china-Guangzhou","name":"hoojo","id":1,"birthday":null,"email":"hoojo_@126.com"},
{"address":"address2","name":"haha2","id":2,"birthday":null,"email":"email2"}]
2###[{"address":"china-Guangzhou","name":"hoojo","id":1,"birthday":null,"email":"hoojo_@126.com"},
{"address":"address2","name":"haha2","id":2,"birthday":null,"email":"email2"}]

外面就是多了個[]中括號;同樣Array也可以轉(zhuǎn)換,轉(zhuǎn)換的JSON和上面的結(jié)果是一樣的,這里就不再轉(zhuǎn)換了。~.~

4、下面來看看jackson提供的一些類型,用這些類型完成json轉(zhuǎn)換;如果你使用這些類型轉(zhuǎn)換JSON的話,那么你即使沒有JavaBean(Entity)也可以完成復(fù)雜的Java類型的JSON轉(zhuǎn)換。下面用到這些類型構(gòu)建一個復(fù)雜的Java對象,并完成JSON轉(zhuǎn)換。

@Test
public void writeOthersJSON() {
  try {
    String[] arr = { "a", "b", "c" };
    System.out.println("jsonGenerator");
    String str = "hello world jackson!";
    //byte
    jsonGenerator.writeBinary(str.getBytes());
    //boolean
    jsonGenerator.writeBoolean(true);
    //null
    jsonGenerator.writeNull();
    //float
    jsonGenerator.writeNumber(2.2f);
    //char
    jsonGenerator.writeRaw("c");
    //String
    jsonGenerator.writeRaw(str, 5, 10);
    //String
    jsonGenerator.writeRawValue(str, 5, 5);
    //String
    jsonGenerator.writeString(str);
    jsonGenerator.writeTree(JsonNodeFactory.instance.POJONode(str));
    System.out.println();
    
    //Object
    jsonGenerator.writeStartObject();//{
    jsonGenerator.writeObjectFieldStart("user");//user:{
    jsonGenerator.writeStringField("name", "jackson");//name:jackson
    jsonGenerator.writeBooleanField("sex", true);//sex:true
    jsonGenerator.writeNumberField("age", 22);//age:22
    jsonGenerator.writeEndObject();//}
    
    jsonGenerator.writeArrayFieldStart("infos");//infos:[
    jsonGenerator.writeNumber(22);//22
    jsonGenerator.writeString("this is array");//this is array
    jsonGenerator.writeEndArray();//]
    
    jsonGenerator.writeEndObject();//}
    
    
    AccountBean bean = new AccountBean();
    bean.setAddress("address");
    bean.setEmail("email");
    bean.setId(1);
    bean.setName("haha");
    //complex Object
    jsonGenerator.writeStartObject();//{
    jsonGenerator.writeObjectField("user", bean);//user:{bean}
    jsonGenerator.writeObjectField("infos", arr);//infos:[array]
    jsonGenerator.writeEndObject();//}
    
  } catch (Exception e) {
    e.printStackTrace();
  }
}

運(yùn)行后,結(jié)果如下:

jsonGenerator
"aGVsbG8gd29ybGQgamFja3NvbiE=" true null 2.2c world jac worl "hello world jackson!" "hello world jackson!"
 {"user":{"name":"jackson","sex":true,"age":22},"infos":[22,"this is array"]} 
{"user":{"address":"address","name":"haha","id":1,"birthday":null,"email":"email"},"infos":["a","b","c"]}

怎么樣?構(gòu)造的json字符串和輸出的結(jié)果是一致的吧。關(guān)鍵看懂用JSONGenerator提供的方法,完成一個Object的構(gòu)建。

三、JSON轉(zhuǎn)換成Java對象

1、 將json字符串轉(zhuǎn)換成JavaBean對象

@Test
public void readJson2Entity() {
  String json = "{\"address\":\"address\",\"name\":\"haha\",\"id\":1,\"email\":\"email\"}";
  try {
    AccountBean acc = objectMapper.readValue(json, AccountBean.class);
    System.out.println(acc.getName());
    System.out.println(acc);
  } catch (JsonParseException e) {
    e.printStackTrace();
  } catch (JsonMappingException e) {
    e.printStackTrace();
  } catch (IOException e) {
    e.printStackTrace();
  }
}

很簡單,用到了ObjectMapper這個對象的readValue這個方法,這個方法需要提供2個參數(shù)。第一個參數(shù)就是解析的JSON字符串,第二個參數(shù)是即將將這個JSON解析吃什么Java對象,Java對象的類型。當(dāng)然,還有其他相同簽名方法,如果你有興趣可以一一嘗試使用方法,當(dāng)然使用的方法和當(dāng)前使用的方法大同小異。運(yùn)行后,結(jié)果如下:

haha
haha#1#address#null#email

2、 將json字符串轉(zhuǎn)換成List<Map>集合

/**
 * <b>function:</b>json字符串轉(zhuǎn)換成list<map>
 * @author hoojo
 */
@Test
public void readJson2List() {
  String json = "[{\"address\": \"address2\",\"name\":\"haha2\",\"id\":2,\"email\":\"email2\"},"+
        "{\"address\":\"address\",\"name\":\"haha\",\"id\":1,\"email\":\"email\"}]";
  try {
    List<LinkedHashMap<String, Object>> list = objectMapper.readValue(json, List.class);
    System.out.println(list.size());
    for (int i = 0; i < list.size(); i++) {
      Map<String, Object> map = list.get(i);
      Set<String> set = map.keySet();
      for (Iterator<String> it = set.iterator();it.hasNext();) {
        String key = it.next();
        System.out.println(key + ":" + map.get(key));
      }
    }
  } catch (JsonParseException e) {
    e.printStackTrace();
  } catch (JsonMappingException e) {
    e.printStackTrace();
  } catch (IOException e) {
    e.printStackTrace();
  }
}

嘗試過將上面的JSON轉(zhuǎn)換成List,然后List中存放AccountBean,但結(jié)果失敗了。但是支持Map集合。因?yàn)槟戕D(zhuǎn)成List.class,但是不知道List存放何種類型。只好默然Map類型。因?yàn)樗械膶ο蠖伎梢赞D(zhuǎn)換成Map結(jié)合,運(yùn)行后結(jié)果如下:

2
address:address2
name:haha2
id:2
email:email2
address:address
name:haha
id:1
email:email

3、 Json字符串轉(zhuǎn)換成Array數(shù)組,由于上面的泛型轉(zhuǎn)換不能識別到集合中的對象類型。所有這里用對象數(shù)組,可以解決這個問題。只不過它不再是集合,而是一個數(shù)組。當(dāng)然這個不重要,你可以用Arrays.asList將其轉(zhuǎn)換成List即可。

/**
 * <b>function:</b>json字符串轉(zhuǎn)換成Array
 * @author hoojo
 */
@Test
public void readJson2Array() {
  String json = "[{\"address\": \"address2\",\"name\":\"haha2\",\"id\":2,\"email\":\"email2\"},"+
      "{\"address\":\"address\",\"name\":\"haha\",\"id\":1,\"email\":\"email\"}]";
  try {
    AccountBean[] arr = objectMapper.readValue(json, AccountBean[].class);
    System.out.println(arr.length);
    for (int i = 0; i < arr.length; i++) {
      System.out.println(arr[i]);
    }
    
  } catch (JsonParseException e) {
    e.printStackTrace();
  } catch (JsonMappingException e) {
    e.printStackTrace();
  } catch (IOException e) {
    e.printStackTrace();
  }
}

運(yùn)行后的結(jié)果:

2
haha2#2#address2#null#email2
haha#1#address#null#email

4、 Json字符串轉(zhuǎn)換成Map集合

/**
 * <b>function:</b>json字符串轉(zhuǎn)換Map集合
 * @author hoojo */
@Test
public void readJson2Map() {
  String json = "{\"success\":true,\"A\":{\"address\": \"address2\",\"name\":\"haha2\",\"id\":2,\"email\":\"email2\"},"+
        "\"B\":{\"address\":\"address\",\"name\":\"haha\",\"id\":1,\"email\":\"email\"}}";
  try {
    Map<String, Map<String, Object>> maps = objectMapper.readValue(json, Map.class);
    System.out.println(maps.size());
    Set<String> key = maps.keySet();
    Iterator<String> iter = key.iterator();
    while (iter.hasNext()) {
      String field = iter.next();
      System.out.println(field + ":" + maps.get(field));
    }
  } catch (JsonParseException e) {
    e.printStackTrace();
  } catch (JsonMappingException e) {
    e.printStackTrace();
  } catch (IOException e) {
    e.printStackTrace();
  }
}

運(yùn)行后結(jié)果如下:

3
success:true
A:{address=address2, name=haha2, id=2, email=email2}
B:{address=address, name=haha, id=1, email=email}

四、Jackson對XML的支持

Jackson也可以完成java對象到xml的轉(zhuǎn)換,轉(zhuǎn)換后的結(jié)果要比json-lib更直觀,不過它依賴于stax2-api.jar這個jar包。

/**
 * <b>function:</b>java對象轉(zhuǎn)換成xml文檔
 * 需要額外的jar包 stax2-api.jar
 * @author hoojo
 */
@Test
public void writeObject2Xml() {
  //stax2-api-3.0.2.jar
  System.out.println("XmlMapper");
  XmlMapper xml = new XmlMapper();
  
  try {
    //javaBean轉(zhuǎn)換成xml
    //xml.writeValue(System.out, bean);
    StringWriter sw = new StringWriter();
    xml.writeValue(sw, bean);
    System.out.println(sw.toString());
    //List轉(zhuǎn)換成xml
    List<AccountBean> list = new ArrayList<AccountBean>();
    list.add(bean);
    list.add(bean);
    System.out.println(xml.writeValueAsString(list));
    
    //Map轉(zhuǎn)換xml文檔
    Map<String, AccountBean> map = new HashMap<String, AccountBean>();
    map.put("A", bean);
    map.put("B", bean);
    System.out.println(xml.writeValueAsString(map));
  } catch (JsonGenerationException e) {
    e.printStackTrace();
  } catch (JsonMappingException e) {
    e.printStackTrace();
  } catch (IOException e) {
    e.printStackTrace();
  }
}

運(yùn)行上面的方法,結(jié)果如下:

XmlMapper
<unknown><address>china-Guangzhou</address><name>hoojo</name><id>1</id><birthday/><email>hoojo_@126.com</email></unknown>
<unknown><unknown><address>china-Guangzhou</address><name>hoojo</name><id>1</id><birthday/><email>hoojo_@126.com</email></unknown>
<email><address>china-Guangzhou</address><name>hoojo</name><id>1</id><birthday/><email>hoojo_@126.com</email></email></unknown>
<unknown><A><address>china-Guangzhou</address><name>hoojo</name><id>1</id><birthday/><email>hoojo_@126.com</email></A>
<B><address>china-Guangzhou</address><name>hoojo</name><id>1</id><birthday/><email>hoojo_@126.com</email></B></unknown>

看結(jié)果,根節(jié)點(diǎn)都是unknown 這個問題還沒有解決,由于根節(jié)點(diǎn)沒有轉(zhuǎn)換出來,所有導(dǎo)致解析xml到Java對象,也無法完成。

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • spring aop之鏈?zhǔn)秸{(diào)用的實(shí)現(xiàn)

    spring aop之鏈?zhǔn)秸{(diào)用的實(shí)現(xiàn)

    這篇文章主要介紹了spring aop之鏈?zhǔn)秸{(diào)用的實(shí)現(xiàn),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-02-02
  • 解決SpringMVC同時(shí)接收J(rèn)son和Restful時(shí)Request里有Map的問題

    解決SpringMVC同時(shí)接收J(rèn)son和Restful時(shí)Request里有Map的問題

    今天小編就為大家分享一篇解決SpringMVC同時(shí)接收J(rèn)son和Restful時(shí)Request里有Map的問題,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-08-08
  • Java事務(wù)管理學(xué)習(xí)之JDBC詳解

    Java事務(wù)管理學(xué)習(xí)之JDBC詳解

    這篇文章主要介紹了Java事務(wù)管理學(xué)習(xí)之JDBC的相關(guān)資料,文中介紹的非常詳細(xì),相信對大家具有一定的參考價(jià)值,需要的朋友們下面來一起看看吧。
    2017-03-03
  • spring?cloud?Gateway如何處理跨域問題

    spring?cloud?Gateway如何處理跨域問題

    這篇文章主要介紹了spring?cloud?Gateway如何處理跨域問題,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-04-04
  • Java eclipse doc文檔生成流程解析

    Java eclipse doc文檔生成流程解析

    這篇文章主要介紹了Java eclipse doc文檔生成流程解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-12-12
  • 如何用java生成指定范圍的隨機(jī)數(shù)

    如何用java生成指定范圍的隨機(jī)數(shù)

    以生成[10,20]隨機(jī)數(shù)為例,首先生成0-20的隨機(jī)數(shù),然后對(20-10+1)取模得到[0-10]之間的隨機(jī)數(shù),然后加上min=10,最后生成的是10-20的隨機(jī)數(shù)
    2013-09-09
  • java 靜態(tài)代理 動態(tài)代理深入學(xué)習(xí)

    java 靜態(tài)代理 動態(tài)代理深入學(xué)習(xí)

    代理模式是常用的java設(shè)計(jì)模式,特征是代理類與委托類有同樣的接口,代理類主要負(fù)責(zé)為委托類預(yù)處理消息、過濾消息、把消息轉(zhuǎn)發(fā)給委托類,以及事后處理消息等,需要的朋友可以參考下
    2012-11-11
  • Springboot調(diào)整接口響應(yīng)返回時(shí)長詳解(解決響應(yīng)超時(shí)問題)

    Springboot調(diào)整接口響應(yīng)返回時(shí)長詳解(解決響應(yīng)超時(shí)問題)

    當(dāng)后端對于數(shù)據(jù)量較大的處理或是某些耗時(shí)的操作時(shí),需要先對請求接口的請求進(jìn)行響應(yīng),下面這篇文章主要給大家介紹了關(guān)于Springboot調(diào)整接口響應(yīng)返回時(shí)長(解決響應(yīng)超時(shí)問題)的相關(guān)資料,需要的朋友可以參考下
    2023-01-01
  • SpringBoot配置application.yml時(shí)遇到的錯誤及解決

    SpringBoot配置application.yml時(shí)遇到的錯誤及解決

    這篇文章主要介紹了SpringBoot配置application.yml時(shí)遇到的錯誤及解決,具有很好的參考價(jià)值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-07-07
  • SpringBoot遇到的坑@Qualifier報(bào)紅的解決

    SpringBoot遇到的坑@Qualifier報(bào)紅的解決

    這篇文章主要介紹了SpringBoot遇到的坑@Qualifier報(bào)紅的解決,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2021-11-11

最新評論