Emmachen / SapUi5Test

1 stars 1 forks source link

@JsonInclude(JsonInclude.Include.NON_NULL) #27

Open ghost opened 8 years ago

ghost commented 8 years ago

clipboard1 http://www.cnblogs.com/yangy608/p/3936848.html

@JsonInclude(Include.NON_NULL) //将该标记放在属性上,如果该属性为NULL则不参与序列化 //如果放在类上边,那对这个类的全部属性起作用 //Include.Include.ALWAYS 默认 //Include.NON_DEFAULT 属性为默认值不序列化 //Include.NON_EMPTY 属性为 空(“”) 或者为 NULL 都不序列化 //Include.NON_NULL 属性为NULL 不序列化

@Generated("org.jsonschema2pojo") http://www.programcreek.com/java-api-examples/index.php?api=javax.annotation.Generated http://docs.oracle.com/javaee/6/api/javax/annotation/Generated.html

The Generated annotation is used to mark source code that has been generated. It can also be used to differentiate user written code from generated code in a single file. When used, the value element must have the name of the code generator. The recommended convention is to use the fully qualified name of the code generator in the value field . For example: com.company.package.classname. The date element is used to indicate the date the source was generated. The date element must follow the ISO 8601 standard. For example the date element would have the following value 2001-07-04T12:08:56.235-0700 which represents 2001-07-04 12:08:56 local time in the U.S. Pacific Time time zone. The comment element is a place holder for any comments that the code generator may want to include in the generated code.

Examples: // ensure that "id" and "name" are output before other properties @JsonPropertyOrder({ "id", "name" }) // order any properties that don't have explicit setting using alphabetic order clipboard2

http://blog.csdn.net/accountwcx/article/details/24585987 Java下常见的Json类库有Gson、JSON-lib和Jackson等,Jackson相对来说比较高效,在项目中主要使用Jackson进行JSON和Java对象转换.