com.jsoniter.annotation.JsonProperty Java Examples

The following examples show how to use com.jsoniter.annotation.JsonProperty. 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: TestAnnotationJsonIgnore.java    From java with MIT License 5 votes vote down vote up
@JsonCreator
public TestObject3(@JsonProperty("field2") final String field) {
    field1 = null;
    fieldXXX = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            System.out.println("field2 is " + field);
        }
    };
}
 
Example #2
Source File: TestAnnotationJsonWrapper.java    From java with MIT License 5 votes vote down vote up
@JsonWrapper
public void foreignFromJson(@JsonProperty(value = "parts", from ={"p2"}, required = false) String parts) {
    if(parts == null){
        return;
    }
    String[] ps = parts.split(",");
    partA = ps[0];
    partB = ps.length > 1 ? ps[1] : null;
}
 
Example #3
Source File: GsonCompatibilityMode.java    From java with MIT License 4 votes vote down vote up
@Override
protected JsonProperty getJsonProperty(Annotation[] annotations) {
    JsonProperty jsoniterObj = super.getJsonProperty(annotations);
    if (jsoniterObj != null) {
        return jsoniterObj;
    }
    final SerializedName gsonObj = getAnnotation(
            annotations, SerializedName.class);
    if (gsonObj == null) {
        return null;
    }
    return new JsonProperty() {

        @Override
        public String value() {
            return "";
        }

        @Override
        public String[] from() {
            return new String[]{gsonObj.value()};
        }

        @Override
        public String[] to() {
            return new String[]{gsonObj.value()};
        }

        @Override
        public boolean required() {
            return false;
        }

        @Override
        public Class<? extends Decoder> decoder() {
            return Decoder.class;
        }

        @Override
        public Class<?> implementation() {
            return Object.class;
        }

        @Override
        public Class<? extends Encoder> encoder() {
            return Encoder.class;
        }

        @Override
        public boolean nullable() {
            return true;
        }

        @Override
        public boolean collectionValueNullable() {
            return true;
        }

        @Override
        public String defaultValueToOmit() {
            return "";
        }

        @Override
        public Class<? extends Annotation> annotationType() {
            return JsonProperty.class;
        }
    };
}
 
Example #4
Source File: TestAnnotationJsonProperty.java    From java with MIT License 4 votes vote down vote up
@JsonProperty("field-1")
public void setField1(String field1) {
    this.field1 = field1;
}
 
Example #5
Source File: TestAnnotationJsonProperty.java    From java with MIT License 4 votes vote down vote up
@JsonCreator
public TestObject10(@JsonProperty("hello") int field) {
    this.field = field;
}
 
Example #6
Source File: TestAnnotation.java    From java with MIT License 4 votes vote down vote up
@JsonCreator
public static TestObject4 createObject(@JsonProperty(value = "field1") int field1) {
    TestObject4 obj = new TestObject4();
    obj.field1 = field1;
    return obj;
}
 
Example #7
Source File: TestAnnotationJsonCreator.java    From java with MIT License 4 votes vote down vote up
@JsonCreator
public TestObject2(@JsonProperty("field1") int field1) {
    this.field1 = field1;
}
 
Example #8
Source File: TestAnnotationJsonCreator.java    From java with MIT License 4 votes vote down vote up
@JsonCreator
public TestObject(@JsonProperty("name") final String name) {
    this.id = name;
    properties = new Properties();
}
 
Example #9
Source File: TestAnnotationJsonCreator.java    From java with MIT License 4 votes vote down vote up
@JsonWrapper
public void setProperties(@JsonProperty("props") final Any props) {
    // Set props
}
 
Example #10
Source File: TestAnnotationJsonProperty.java    From java with MIT License 4 votes vote down vote up
@JsonProperty("field-1")
public String getField1() {
    return field1;
}
 
Example #11
Source File: TestAnnotationJsonProperty.java    From java with MIT License 4 votes vote down vote up
@JsonProperty("field-1")
public String getField1() {
    return field1;
}
 
Example #12
Source File: TestObject.java    From java with MIT License 4 votes vote down vote up
@JsonProperty(defaultValueToOmit = "void")
public int[] getField1() {
    return field1;
}
 
Example #13
Source File: TestAnnotationJsonWrapper.java    From java with MIT License 4 votes vote down vote up
@JsonWrapper
public void initialize(@JsonProperty("field1") int field1) {
    this._field1 = field1;
}
 
Example #14
Source File: TestObject.java    From java with MIT License 4 votes vote down vote up
@JsonProperty(from = {"field-1"})
public void setField1(String obj) {
    field1 = "!!!" + obj;
}
 
Example #15
Source File: TestAnnotation.java    From java with MIT License 2 votes vote down vote up
@JsonCreator
public TestObject8(@JsonProperty(required = true) int param1) {

}
 
Example #16
Source File: TestAnnotation.java    From java with MIT License 2 votes vote down vote up
@JsonCreator
public void initialize(@JsonProperty("field1") int field1) {

}