org.codehaus.jackson.map.annotate.JsonDeserialize Java Examples

The following examples show how to use org.codehaus.jackson.map.annotate.JsonDeserialize. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JacksonUnionExtension.java    From raml-java-tools with Apache License 2.0 6 votes vote down vote up
@Override
public TypeSpec.Builder classCreated(UnionPluginContext unionPluginContext, UnionTypeDeclaration ramlType, TypeSpec.Builder incoming, EventType eventType) {

    ClassName deserializer =
            ClassName.get("", unionPluginContext.creationResult().getJavaName(EventType.INTERFACE).simpleName(),
                    Names.typeName(ramlType.name(), "deserializer"));

    ClassName serializer =
            ClassName.get("", unionPluginContext.creationResult().getJavaName(EventType.INTERFACE).simpleName(),
                    Names.typeName("serializer"));

    createSerializer(unionPluginContext, serializer, ramlType, incoming, eventType);
    createDeserializer(unionPluginContext, deserializer, ramlType, incoming, eventType);

    incoming.addAnnotation(AnnotationSpec.builder(JsonDeserialize.class)
            .addMember("using", "$T.class", deserializer).build());
    incoming.addAnnotation(AnnotationSpec.builder(JsonSerialize.class)
            .addMember("using", "$T.class", serializer).build());

    return incoming;
}
 
Example #2
Source File: TsBlackListEntity.java    From jeecg with Apache License 2.0 5 votes vote down vote up
/**
 *方法: 取得java.util.Date
 *@return: java.util.Date  更新日期
 */

@Column(name ="UPDATE_DATE",nullable=true,length=20)
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
public java.util.Date getUpdateDate(){
	return this.updateDate;
}
 
Example #3
Source File: TSDepart.java    From jeecg with Apache License 2.0 5 votes vote down vote up
/**
 *方法: 取得java.util.Date
 *@return: java.util.Date  更新日期
 */

@Column(name ="UPDATE_DATE",nullable=true,length=20)
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
public java.util.Date getUpdateDate(){
	return this.updateDate;
}
 
Example #4
Source File: JacksonDiscriminatorInheritanceTypeExtension.java    From raml-java-tools with Apache License 2.0 4 votes vote down vote up
@Override
public TypeSpec.Builder classCreated(ObjectPluginContext objectPluginContext, ObjectTypeDeclaration ramlType, TypeSpec.Builder typeSpec, EventType eventType) {

  if ( eventType == EventType.IMPLEMENTATION) {
    return typeSpec;
  }

  ObjectTypeDeclaration otr = ramlType;

  if (otr.discriminator() != null && objectPluginContext.childClasses(otr.name()).size() > 0) {

    typeSpec.addAnnotation(AnnotationSpec.builder(JsonTypeInfo.class)
            .addMember("use", "$T.Id.NAME", JsonTypeInfo.class)
            .addMember("include", "$T.As.EXISTING_PROPERTY", JsonTypeInfo.class)
            .addMember("property", "$S", otr.discriminator()).build());

    AnnotationSpec.Builder subTypes = AnnotationSpec.builder(JsonSubTypes.class);
    for (CreationResult result : objectPluginContext.childClasses(ramlType.name())) {

      subTypes.addMember(
              "value",
              "$L",
              AnnotationSpec
                      .builder(JsonSubTypes.Type.class)
                      .addMember("value", "$L",
                              result.getJavaName(EventType.INTERFACE) + ".class").build());
    }

    subTypes.addMember(
            "value",
            "$L",
            AnnotationSpec
                    .builder(JsonSubTypes.Type.class)
                    .addMember("value", "$L",
                            objectPluginContext.creationResult().getJavaName(EventType.INTERFACE) + ".class").build());

    typeSpec.addAnnotation(subTypes.build());

  }

  if (otr.discriminatorValue() != null) {

    typeSpec.addAnnotation(AnnotationSpec.builder(JsonTypeName.class)
            .addMember("value", "$S", otr.discriminatorValue()).build());
  }


  if (!Annotations.ABSTRACT.get(otr)) {

    typeSpec.addAnnotation(AnnotationSpec.builder(JsonDeserialize.class)
            .addMember("as", "$T.class", objectPluginContext.creationResult().getJavaName(EventType.IMPLEMENTATION))
            .build());
  }


  return typeSpec;
}
 
Example #5
Source File: JpaMedia.java    From jwala with Apache License 2.0 4 votes vote down vote up
@JsonDeserialize(using = StringToPathDeserializer.class)
public void setLocalPath(final Path localPath) {
    this.localPath = localPath.toString();
}
 
Example #6
Source File: JpaMedia.java    From jwala with Apache License 2.0 4 votes vote down vote up
@JsonDeserialize(using = StringToPathDeserializer.class)
public void setRemoteDir(final Path remoteDir) {
    this.remoteDir = remoteDir.toString();
}
 
Example #7
Source File: JpaMedia.java    From jwala with Apache License 2.0 4 votes vote down vote up
@JsonDeserialize(using = StringToPathDeserializer.class)
public void setRootDir(final Path rootDir) {
    this.rootDir = rootDir.toString();
}
 
Example #8
Source File: Media.java    From jwala with Apache License 2.0 4 votes vote down vote up
@JsonDeserialize(using = StringToPathDeserializer.class)
public void setLocalPath(Path localPath) {
    this.localPath = localPath;
}
 
Example #9
Source File: Media.java    From jwala with Apache License 2.0 4 votes vote down vote up
@JsonDeserialize(using = StringToPathDeserializer.class)
public void setRemoteDir(Path remoteDir) {
    this.remoteDir = remoteDir;
}
 
Example #10
Source File: Media.java    From jwala with Apache License 2.0 4 votes vote down vote up
@JsonDeserialize(using = StringToPathDeserializer.class)
public void setRootDir(Path rootDir) {
    this.rootDir = rootDir;
}
 
Example #11
Source File: TsBlackListEntity.java    From jeecg with Apache License 2.0 4 votes vote down vote up
/**
 *方法: 设置java.util.Date
 *@param: java.util.Date  创建日期
 */
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
public void setCreateDate(java.util.Date createDate){
	this.createDate = createDate;
}
 
Example #12
Source File: TSDepart.java    From jeecg with Apache License 2.0 4 votes vote down vote up
/**
 *方法: 设置java.util.Date
 *@param: java.util.Date  创建日期
 */
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
public void setCreateDate(java.util.Date createDate){
	this.createDate = createDate;
}
 
Example #13
Source File: JeecgDemoEntity.java    From jeecg with Apache License 2.0 4 votes vote down vote up
/**
 *方法: 设置java.util.Date
 *@param: java.util.Date  生日
 */
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
public void setBirthday(java.util.Date birthday){
	this.birthday = birthday;
}
 
Example #14
Source File: JeecgDemoEntity.java    From jeecg with Apache License 2.0 4 votes vote down vote up
/**
 *方法: 设置java.util.Date
 *@param: java.util.Date  createDate
 */
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
public void setCreateDate(java.util.Date createDate){
	this.createDate = createDate;
}