use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty in project hono by eclipse.
the class TrustedCertificateAuthority method setCertificate.
/**
* Sets the trusted certificate authority.
*
* @param certificate The DER encoded X.509 certificate.
* @return A reference to this for fluent use.
* @throws CertificateException if the byte array cannot be deserialized into an X.509 certificate.
*/
@JsonProperty(TenantConstants.FIELD_PAYLOAD_CERT)
public final TrustedCertificateAuthority setCertificate(final byte[] certificate) throws CertificateException {
final CertificateFactory factory = CertificateFactory.getInstance("X.509");
cert = (X509Certificate) factory.generateCertificate(new ByteArrayInputStream(certificate));
return this;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty in project knime-core by knime.
the class SubnodeContainerExecutionResult method setWorkflowExecutionResult.
/**
* Sets inner execution result.
* @param workflowExecutionResult To be set, must have correct baseID.
* @throws IllegalArgumentException If the id prefix is invalid or argument is null
*/
@JsonProperty("workflowExecResult")
public void setWorkflowExecutionResult(final WorkflowExecutionResult workflowExecutionResult) {
m_workflowExecutionResult = CheckUtils.checkArgumentNotNull(workflowExecutionResult, "Arg must not be null");
CheckUtils.checkArgument(new NodeID(m_baseID, 0).equals(m_workflowExecutionResult.getBaseID()), "Unexpected ID of inner wfm result, expected %s but got %s", new NodeID(m_baseID, 0), m_workflowExecutionResult.getBaseID());
m_workflowExecutionResult = workflowExecutionResult;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty in project POL-POM-5 by PhoenicisOrg.
the class LocalisationHelper method fetchParameterName.
private String fetchParameterName(Parameter parameter) {
final JsonProperty jsonAnnotation = parameter.getAnnotation(JsonProperty.class);
final ParameterName parameterNameAnnotation = parameter.getAnnotation(ParameterName.class);
if (parameterNameAnnotation != null) {
return parameterNameAnnotation.value();
}
if (jsonAnnotation != null) {
return jsonAnnotation.value();
}
return parameter.getName();
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty in project autorest-clientruntime-for-java by Azure.
the class AdditionalPropertiesDeserializer method getModule.
/**
* Gets a module wrapping this serializer as an adapter for the Jackson
* ObjectMapper.
*
* @param mapper the object mapper for default deserializations
* @return a simple module to be plugged onto Jackson ObjectMapper.
*/
public static SimpleModule getModule(final ObjectMapper mapper) {
SimpleModule module = new SimpleModule();
module.setDeserializerModifier(new BeanDeserializerModifier() {
@Override
public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer<?> deserializer) {
for (Class<?> c : TypeToken.of(beanDesc.getBeanClass()).getTypes().classes().rawTypes()) {
Field[] fields = c.getDeclaredFields();
for (Field field : fields) {
if ("additionalProperties".equalsIgnoreCase(field.getName())) {
JsonProperty property = field.getAnnotation(JsonProperty.class);
if (property != null && property.value().isEmpty()) {
return new AdditionalPropertiesDeserializer(beanDesc.getBeanClass(), deserializer, mapper);
}
}
}
}
return deserializer;
}
});
return module;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty in project autorest-clientruntime-for-java by Azure.
the class FlatteningDeserializer method handleFlatteningForField.
/**
* Given a field of a POJO class and JsonNode corresponds to the same POJO class,
* check field's {@link JsonProperty} has flattening dots in it if so
* flatten the nested child JsonNode corresponds to the field in the given JsonNode.
*
* @param classField the field in a POJO class
* @param jsonNode the json node corresponds to POJO class that field belongs to
*/
@SuppressWarnings("unchecked")
private static void handleFlatteningForField(Field classField, JsonNode jsonNode) {
final JsonProperty jsonProperty = classField.getAnnotation(JsonProperty.class);
if (jsonProperty != null) {
final String jsonPropValue = jsonProperty.value();
if (jsonNode.has(jsonPropValue)) {
// There is an additional property with it's key conflicting with the
// JsonProperty value, escape this additional property's key.
final String escapedJsonPropValue = jsonPropValue.replace(".", "\\.");
((ObjectNode) jsonNode).set(escapedJsonPropValue, jsonNode.get(jsonPropValue));
}
if (containsFlatteningDots(jsonPropValue)) {
// The jsonProperty value contains flattening dots, uplift the nested
// json node that this value resolving to the current level.
JsonNode childJsonNode = findNestedNode(jsonNode, jsonPropValue);
((ObjectNode) jsonNode).set(jsonPropValue, childJsonNode);
}
}
}
Aggregations