com.fasterxml.jackson.annotation.JsonRawValue Java Examples
The following examples show how to use
com.fasterxml.jackson.annotation.JsonRawValue.
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: JsonRawStringAspect.java From mojito with Apache License 2.0 | 5 votes |
/** * TODO(P2) try to do this with aspect @DeclareError * * Checks that the method annotated with {@link JsonRawString} also has the * {@link JsonRawValue} for Jackson to actually serialize as expected. * * @param pjp */ private void checkMethodHasJsonRawValueAnnotation(ProceedingJoinPoint pjp) { MethodSignature methodSignature = (MethodSignature) pjp.getSignature(); Method targetMethod = methodSignature.getMethod(); if (targetMethod.getAnnotation(JsonRawValue.class) == null) { throw new RuntimeException("The method annotated with @JsonRawString must also be annotated with @JsonRawValue"); } }
Example #2
Source File: ApiResponse.java From spring-async with MIT License | 5 votes |
@JsonRawValue public String getBody() { if(body != null && body.trim().isEmpty()) { return null; } return body; }
Example #3
Source File: ModelData.java From syndesis with Apache License 2.0 | 5 votes |
@JsonRawValue @JsonProperty("data") public String getDataAsJson() throws JsonProcessingException { if (json == null) { json = JsonUtils.writer().writeValueAsString(data); } return json; }
Example #4
Source File: Operation.java From product-emm with Apache License 2.0 | 4 votes |
@JsonRawValue public Object getPayLoad() { return payLoad; }
Example #5
Source File: JsonRawStringAspectAnnotated.java From mojito with Apache License 2.0 | 4 votes |
@JsonRawValue @JsonRawString public String getJsonString() { return "{\"a\": 1, \"b\": [1,2,3]}"; }
Example #6
Source File: JsonRawStringAspectAnnotated.java From mojito with Apache License 2.0 | 4 votes |
@JsonRawValue @JsonRawString public String getNonJsonString() { return "This is a simple string that doesn't contain JSON"; }
Example #7
Source File: VersionedCommandOperation.java From apicurio-studio with Apache License 2.0 | 4 votes |
@JsonRawValue public JsonNode getCommand() { return command; }
Example #8
Source File: VersionedCommandOperation.java From apicurio-studio with Apache License 2.0 | 4 votes |
@JsonRawValue public VersionedCommandOperation setCommand(JsonNode command) { this.command = command; return this; }
Example #9
Source File: JsonHttpLogFormatter.java From logbook with MIT License | 4 votes |
@JsonRawValue @JsonValue public String getJson() { return json; }
Example #10
Source File: Step.java From cukedoctor with Apache License 2.0 | 4 votes |
@JsonRawValue public List<Output> getOutput() { return output; }
Example #11
Source File: JsonGraph.java From hugegraph-tools with Apache License 2.0 | 4 votes |
@JsonRawValue public String getProperties() { return this.properties; }
Example #12
Source File: RppIndex.java From govpay with GNU General Public License v3.0 | 4 votes |
@JsonProperty("rpt") @JsonRawValue public String getRpt() { return this.rpt; }
Example #13
Source File: RppIndex.java From govpay with GNU General Public License v3.0 | 4 votes |
@JsonProperty("rt") @JsonRawValue public String getRt() { return this.rt; }
Example #14
Source File: Rpp.java From govpay with GNU General Public License v3.0 | 4 votes |
@JsonProperty("rpt") @JsonRawValue public String getRpt() { return this.rpt; }
Example #15
Source File: Rpp.java From govpay with GNU General Public License v3.0 | 4 votes |
@JsonProperty("rt") @JsonRawValue public String getRt() { return this.rt; }
Example #16
Source File: Tracciato.java From govpay with GNU General Public License v3.0 | 4 votes |
@JsonProperty("beanDati") @JsonRawValue public Object getBeanDati() { return this.beanDati; }
Example #17
Source File: PropertyProcessor.java From gwt-jackson with Apache License 2.0 | 4 votes |
private static Optional<PropertyInfo> processProperty( RebindConfiguration configuration, TreeLogger logger, JacksonTypeOracle typeOracle, PropertyAccessors propertyAccessors, BeanInfo beanInfo, boolean samePackage ) throws UnableToCompleteException { boolean getterAutoDetected = isGetterAutoDetected( configuration, propertyAccessors, beanInfo ); boolean setterAutoDetected = isSetterAutoDetected( configuration, propertyAccessors, beanInfo ); boolean fieldAutoDetected = isFieldAutoDetected( configuration, propertyAccessors, beanInfo ); if ( !getterAutoDetected && !setterAutoDetected && !fieldAutoDetected && !propertyAccessors.getParameter().isPresent() ) { // none of the field have been auto-detected, we ignore the field return Optional.absent(); } final String propertyName = propertyAccessors.getPropertyName(); final JType type = findType( logger, propertyAccessors, typeOracle, getterAutoDetected, setterAutoDetected, fieldAutoDetected ); PropertyInfoBuilder builder = new PropertyInfoBuilder( propertyName, type ); builder.setIgnored( isPropertyIgnored( configuration, propertyAccessors, beanInfo, type, propertyName ) ); if ( builder.isIgnored() ) { return Optional.of( builder.build() ); } Optional<JsonProperty> jsonProperty = propertyAccessors.getAnnotation( JsonProperty.class ); builder.setRequired( jsonProperty.isPresent() && jsonProperty.get().required() ); Optional<JsonManagedReference> jsonManagedReference = propertyAccessors.getAnnotation( JsonManagedReference.class ); builder.setManagedReference( Optional.fromNullable( jsonManagedReference.isPresent() ? jsonManagedReference.get() .value() : null ) ); Optional<JsonBackReference> jsonBackReference = propertyAccessors.getAnnotation( JsonBackReference.class ); builder.setBackReference( Optional.fromNullable( jsonBackReference.isPresent() ? jsonBackReference.get().value() : null ) ); if ( !builder.getBackReference().isPresent() ) { determineGetter( propertyAccessors, samePackage, getterAutoDetected, fieldAutoDetected, builder ); Optional<JsonRawValue> jsonRawValue = propertyAccessors.getAnnotation( JsonRawValue.class ); builder.setRawValue( jsonRawValue.isPresent() && jsonRawValue.get().value() ); } determineSetter( propertyAccessors, samePackage, setterAutoDetected, fieldAutoDetected, builder ); Optional<JsonValue> jsonValue = propertyAccessors.getAnnotation( JsonValue.class ); if ( jsonValue.isPresent() && jsonValue.get().value() && builder.getGetterAccessor().isPresent() && builder.getGetterAccessor() .get().getMethod().isPresent() ) { builder.setValue( true ); } Optional<JsonAnyGetter> jsonAnyGetter = propertyAccessors.getAnnotation( JsonAnyGetter.class ); if ( jsonAnyGetter.isPresent() && builder.getGetterAccessor().isPresent() && builder.getGetterAccessor().get().getMethod() .isPresent() ) { builder.setAnyGetter( true ); } Optional<JsonAnySetter> jsonAnySetter = propertyAccessors.getAnnotation( JsonAnySetter.class ); if ( jsonAnySetter.isPresent() && builder.getSetterAccessor().isPresent() && builder.getSetterAccessor().get().getMethod() .isPresent() && builder.getSetterAccessor().get().getMethod().get().getParameterTypes().length == 2 ) { builder.setAnySetter( true ); } Optional<JsonUnwrapped> jsonUnwrapped = propertyAccessors.getAnnotation( JsonUnwrapped.class ); if ( jsonUnwrapped.isPresent() && jsonUnwrapped.get().enabled() ) { builder.setUnwrapped( true ); } processBeanAnnotation( logger, typeOracle, configuration, type, propertyAccessors, builder ); builder.setFormat( propertyAccessors.getAnnotation( JsonFormat.class ) ); Optional<JsonInclude> jsonInclude = propertyAccessors.getAnnotation( JsonInclude.class ); if ( jsonInclude.isPresent() ) { builder.setInclude( Optional.of( jsonInclude.get().value() ) ); } else { builder.setInclude( beanInfo.getInclude() ); } Optional<JsonIgnoreProperties> jsonIgnoreProperties = propertyAccessors.getAnnotation( JsonIgnoreProperties.class ); if ( jsonIgnoreProperties.isPresent() ) { builder.setIgnoreUnknown( Optional.of( jsonIgnoreProperties.get().ignoreUnknown() ) ); if ( null != jsonIgnoreProperties.get().value() && jsonIgnoreProperties.get().value().length > 0 ) { builder.setIgnoredProperties( Optional.of( jsonIgnoreProperties.get().value() ) ); } } return Optional.of( builder.build() ); }
Example #18
Source File: JsonRawValueTester.java From gwt-jackson with Apache License 2.0 | 4 votes |
@JsonProperty("raw") @JsonRawValue public T foobar() { return _value; }
Example #19
Source File: JsonRawValueTester.java From gwt-jackson with Apache License 2.0 | 4 votes |
@JsonProperty @JsonRawValue protected T value() { return _value; }
Example #20
Source File: JsonRawStringAspectNotAnnotated.java From mojito with Apache License 2.0 | 4 votes |
@JsonRawValue public String getJsonString() { return "{\"a\": 1, \"b\": [1,2,3]}"; }
Example #21
Source File: TableFinishInfo.java From presto with Apache License 2.0 | 4 votes |
@JsonProperty @JsonRawValue public String getConnectorOutputMetadata() { return connectorOutputMetadata; }
Example #22
Source File: JsonGraph.java From hugegraph-tools with Apache License 2.0 | 4 votes |
@JsonRawValue public String getProperties() { return this.properties; }
Example #23
Source File: FilterParameter.java From poli with MIT License | 4 votes |
@JsonRawValue public String getValue() { return value; }
Example #24
Source File: Component.java From poli with MIT License | 4 votes |
@JsonRawValue public String getData() { return data; }
Example #25
Source File: Component.java From poli with MIT License | 4 votes |
@JsonRawValue public String getDrillThrough() { return drillThrough; }
Example #26
Source File: Component.java From poli with MIT License | 4 votes |
@JsonRawValue public String getStyle() { return style; }
Example #27
Source File: Report.java From poli with MIT License | 4 votes |
@JsonRawValue public String getStyle() { return style; }
Example #28
Source File: CannedReport.java From poli with MIT License | 4 votes |
@JsonRawValue public String getData() { return data; }
Example #29
Source File: Json.java From swagger-dubbo with Apache License 2.0 | 4 votes |
@JsonValue @JsonRawValue public String value() { return value; }
Example #30
Source File: ModelData.java From syndesis with Apache License 2.0 | 4 votes |
@JsonRawValue @JsonProperty("data") public void setDataFromJson(JsonNode json) throws JsonProcessingException { this.data = null; this.json = JsonUtils.writer().writeValueAsString(json); }