Skip to content

Commit

Permalink
% 发布 3.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
fuqianyu committed Sep 27, 2021
1 parent 6626206 commit f65a1a5
Show file tree
Hide file tree
Showing 42 changed files with 143 additions and 46 deletions.
2 changes: 1 addition & 1 deletion androidjson-to-easyjson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion boonjson-to-easyjson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion easyjson-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion easyjson-fastjson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion easyjson-gson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion easyjson-jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ private Date parseDate(JsonParser p, DeserializationContext ctx) throws IOExcept
try {
return df.parse(p.getValueAsString());
} catch (ParseException e) {
logger.error(e.getMessage(),e);
logger.error(e.getMessage(), e);
return null;
}
} else if (usingToString) {
return new Date(p.getValueAsString());
} else {
return null;
if (usingToString) {
return new Date(p.getValueAsString());
} else {
return ctx.parseDate(p.getValueAsString());
}
}
}
if (curr.isNumeric()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public JsonDeserializer<?> build() {
private BeanPropertyMap createPropertyMap(Collection<SettableBeanProperty> props) {
boolean caseInsensitive = getDeserializationConfig().isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES);
if (BeanPropertyMap_construct_3args_method != null) {
Reflects.invoke(BeanPropertyMap_construct_3args_method, null, new Object[]{props, caseInsensitive, constructBeanPropertyMap(props)}, true, true);
return Reflects.invoke(BeanPropertyMap_construct_3args_method, null, new Object[]{props, caseInsensitive, constructBeanPropertyMap(props)}, true, true);
}
return BeanPropertyMap.construct(props, getDeserializationConfig().isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES));
}
Expand Down
2 changes: 1 addition & 1 deletion easyjson-javaxjson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>easyjson</artifactId>
<groupId>com.github.fangjinuo.easyjson</groupId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion easyjson-test/easyjson-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion easyjson-test/easyjson-test-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-base</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test-fastjson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-fastjson-base</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test-fastjson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-fastjson-impl</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test-fastjson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-fastjson-to-gson</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test-fastjson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-fastjson-to-jackson</artifactId>
Expand All @@ -19,6 +19,7 @@
</description>
<properties>
<jmh.version>1.32</jmh.version>
<jackson.version>2.12.5</jackson.version>
</properties>
<dependencies>
<dependency>
Expand All @@ -45,12 +46,12 @@
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.12.5</version>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.5</version>
<version>${jackson.version}</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package com.jn.easyjson.tests.cases.fastjson_to_jackson;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.easyjson.FastEasyJsons;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
import com.fasterxml.jackson.databind.util.StdConverter;
import com.jn.easyjson.core.JsonHandler;
import com.jn.easyjson.jackson.JacksonAdapter;
import org.junit.Assert;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
* <h3></h3>
*
* @author jiaxiaotong
* @version 1.0.0
* @createTime 2020/6/22 12:22 下午
*/
public class NoSpringTest1 {


public static void main(String[] args) throws Exception {
com.jn.easyjson.core.JSON json = FastEasyJsons.getJSONFactory(JSON.DEFAULT_GENERATE_FEATURE).get();
JsonHandler jsonHandler = json.getJsonHandler();
JacksonAdapter jacksonAdapter = (JacksonAdapter) jsonHandler;

ObjectMapper objectMapper = jacksonAdapter.getDelegate();
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
objectMapper.setSerializerProvider(new DefaultSerializerProvider.Impl());

String jsonStr = "{\"date\":\"1630484219.328283\",\"date1\":\"2021-07-10 01:01:01\"}";

Test test = JSON.parseObject(jsonStr, Test.class);

ObjectMapper objectMapper1 = new ObjectMapper();
objectMapper1.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
objectMapper1.setSerializerProvider(new DefaultSerializerProvider.Impl());

Test test1 = objectMapper1.readValue(jsonStr, Test.class);

Assert.assertEquals(test.getDate(), test1.getDate());
Assert.assertEquals(test.getDate1(), test1.getDate1());

}

public static class Test {

@JsonDeserialize(converter = StringToLocalDatetimeConverter.class)
private Date date;

private Date date1;

public Date getDate() {
return date;
}

public void setDate(Date date) {
this.date = date;
}

public Date getDate1() {
return date1;
}

public void setDate1(Date date1) {
this.date1 = date1;
}
}


}

class StringToLocalDatetimeConverter extends StdConverter<String, Date> {
@Override
public Date convert(String value) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (value.contains(".")) {
value = value.split("\\.")[0];
return new Date(Long.parseLong(value));
} else {
try {
return sdf.parse(value);
} catch (ParseException e) {
e.printStackTrace();
}
}
return null;
}
}
2 changes: 1 addition & 1 deletion easyjson-test/easyjson-test-fastjson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-fastjson</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test-gson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-gson-base</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test-gson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-gson-impl</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test-gson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test-gson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion easyjson-test/easyjson-test-gson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-gson</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test-jackson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-jackson-base</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test-jackson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-jackson-impl</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion easyjson-test/easyjson-test-jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-jackson</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test-jsonlib</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-jsonlib-base</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test-jsonlib</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-jsonlib-to-fastjson</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test-jsonlib</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-jsonlib-to-gson</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test-jsonlib</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-jsonlib-to-jackson</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion easyjson-test/easyjson-test-jsonlib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson-test</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test-jsonlib</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion easyjson-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.github.fangjinuo.easyjson</groupId>
<artifactId>easyjson</artifactId>
<version>3.2.7</version>
<version>3.2.8</version>
</parent>

<artifactId>easyjson-test</artifactId>
Expand Down
Loading

0 comments on commit f65a1a5

Please sign in to comment.