Search in sources :

Example 11 with JsonProperty

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty in project pinpoint by naver.

the class TransactionInfoViewModel method getApplicationMapData.

@JsonProperty("applicationMapData")
public Map<String, List<Object>> getApplicationMapData() {
    Map<String, List<Object>> result = new HashMap<String, List<Object>>();
    if (timeHistogramFormat == TimeHistogramFormat.V2) {
        for (Node node : nodes) {
            node.setTimeHistogramFormat(timeHistogramFormat);
        }
        for (Link link : links) {
            link.setTimeHistogramFormat(timeHistogramFormat);
        }
    }
    List<Object> nodeDataArray = new ArrayList<>(nodes);
    result.put("nodeDataArray", nodeDataArray);
    List<Object> linkDataArray = new ArrayList<>(links);
    result.put("linkDataArray", linkDataArray);
    return result;
}
Also used : HashMap(java.util.HashMap) Node(com.navercorp.pinpoint.web.applicationmap.nodes.Node) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Link(com.navercorp.pinpoint.web.applicationmap.link.Link) JsonProperty(com.fasterxml.jackson.annotation.JsonProperty)

Example 12 with JsonProperty

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty in project chassis by Kixeye.

the class ConstructorParameterModelProperty method getModelProperties.

/**
 * Creates a collection of ConstructorParameterModelProperty objects from the arguments of the given ResolvedConstructor.
 * Only args annotated with @JsonProperty are included. Scala Case Classes are a special case and do not require the annotation.
 *
 * @param resolvedConstructor the constructor to get
 * @param alternateTypeProvider for resolving alternative types for the found arguments
 * @return the collection of ConstructorParameterModelProperty objects
 */
public static ImmutableList<ConstructorParameterModelProperty> getModelProperties(ResolvedConstructor resolvedConstructor, AlternateTypeProvider alternateTypeProvider) {
    Builder<ConstructorParameterModelProperty> listBuilder = new Builder<>();
    if (resolvedConstructor.getRawMember().getAnnotation(JsonCreator.class) != null || scala.Product.class.isAssignableFrom(resolvedConstructor.getDeclaringType().getErasedType())) {
        // constructor for normal classes must be annotated with @JsonCreator. Scala Case Classes are a special case
        for (int i = 0; i < resolvedConstructor.getArgumentCount(); i++) {
            AnnotationMap annotationMap = annotationMap(resolvedConstructor.getRawMember().getParameterAnnotations()[i]);
            ResolvedType parameterType = resolvedConstructor.getArgumentType(i);
            if (annotationMap.get(JsonProperty.class) != null) {
                listBuilder.add(new ConstructorParameterModelProperty(parameterType, alternateTypeProvider, annotationMap));
            }
        }
    }
    return listBuilder.build();
}
Also used : JsonProperty(com.fasterxml.jackson.annotation.JsonProperty) AnnotationMap(com.fasterxml.jackson.databind.introspect.AnnotationMap) Builder(com.google.common.collect.ImmutableList.Builder) ResolvedType(com.fasterxml.classmate.ResolvedType)

Example 13 with JsonProperty

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty in project jirm by agentgt.

the class SqlParameterDefinition method getSqlBeanParametersFromJsonCreatorConstructor.

private static Map<String, SqlParameterDefinition> getSqlBeanParametersFromJsonCreatorConstructor(Constructor<?> c, SqlObjectConfig config) {
    Map<String, SqlParameterDefinition> parameters = new LinkedHashMap<String, SqlParameterDefinition>();
    Annotation[][] aas = c.getParameterAnnotations();
    Class<?>[] pts = c.getParameterTypes();
    if (aas == null || aas.length == 0) {
        return parameters;
    }
    for (int i = 0; i < aas.length; i++) {
        Annotation[] as = aas[i];
        Class<?> parameterType = pts[i];
        for (int j = 0; j < as.length; j++) {
            Annotation a = as[j];
            if (JsonProperty.class.equals(a.annotationType())) {
                JsonProperty p = (JsonProperty) a;
                String value = p.value();
                final SqlParameterDefinition definition = parameterDef(config, c.getDeclaringClass(), value, parameterType, i);
                parameters.put(value, definition);
            }
        }
    }
    return parameters;
}
Also used : JsonProperty(com.fasterxml.jackson.annotation.JsonProperty) Annotation(java.lang.annotation.Annotation) LinkedHashMap(java.util.LinkedHashMap)

Example 14 with JsonProperty

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty in project OpenRefine by OpenRefine.

the class FileProjectManager method loadProjects.

@JsonProperty("projectIDs")
protected void loadProjects(List<Long> projectIDs) {
    for (Long id : projectIDs) {
        File projectDir = getProjectDir(id);
        ProjectMetadata metadata = ProjectMetadataUtilities.load(projectDir);
        mergeEmptyUserMetadata(metadata);
        _projectsMetadata.put(id, metadata);
        if (metadata != null && metadata.getTags() != null) {
            for (String tag : metadata.getTags()) {
                if (_projectsTags.containsKey(tag)) {
                    _projectsTags.put(tag, _projectsTags.get(tag) + 1);
                } else {
                    _projectsTags.put(tag, 1);
                }
            }
        }
    }
}
Also used : ProjectMetadata(com.google.refine.ProjectMetadata) File(java.io.File) JsonProperty(com.fasterxml.jackson.annotation.JsonProperty)

Example 15 with JsonProperty

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty in project dhis2-core by dhis2.

the class ImportReport method getStats.

@JsonProperty
@JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
public Stats getStats() {
    Stats stats = new Stats();
    typeReportMap.values().forEach(typeReport -> stats.merge(typeReport.getStats()));
    return stats;
}
Also used : Stats(org.hisp.dhis.feedback.Stats) JsonProperty(com.fasterxml.jackson.annotation.JsonProperty) JacksonXmlProperty(com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty)

Aggregations

JsonProperty (com.fasterxml.jackson.annotation.JsonProperty)45 Field (java.lang.reflect.Field)12 ArrayList (java.util.ArrayList)10 Annotation (java.lang.annotation.Annotation)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 NamedType (com.fasterxml.jackson.databind.jsontype.NamedType)6 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)6 Method (java.lang.reflect.Method)6 Type (java.lang.reflect.Type)6 BeanDescription (com.fasterxml.jackson.databind.BeanDescription)5 JsonNode (com.fasterxml.jackson.databind.JsonNode)5 HashMap (java.util.HashMap)5 Map (java.util.Map)5 JsonCreator (com.fasterxml.jackson.annotation.JsonCreator)4 JavaType (com.fasterxml.jackson.databind.JavaType)4 AnnotatedClass (com.fasterxml.jackson.databind.introspect.AnnotatedClass)4 JsonSchema (com.fasterxml.jackson.module.jsonSchema.JsonSchema)4 JsonSchemaGenerator (com.fasterxml.jackson.module.jsonSchema.JsonSchemaGenerator)4 List (java.util.List)4 JsonIdentityInfo (com.fasterxml.jackson.annotation.JsonIdentityInfo)3