类com.fasterxml.jackson.annotation.JsonUnwrapped源码实例Demo

下面列出了怎么用com.fasterxml.jackson.annotation.JsonUnwrapped的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: istio-java-api   文件: IstioTypeAnnotator.java
@Override
public void propertyField(JFieldVar field, JDefinedClass clazz, String propertyName, JsonNode propertyNode) {
    propertyName = propertyName.equals("deprecatedAllowOrigin") ? "allowOrigin" : propertyName;
    super.propertyField(field, clazz, propertyName, propertyNode);
    if (propertyNode.hasNonNull(IS_INTERFACE_FIELD)) {
        field.annotate(JsonUnwrapped.class);

        // todo: fix me, this won't work if a type has several fields using interfaces
        String interfaceFQN = propertyNode.get(EXISTING_JAVA_TYPE_FIELD).asText();

        // create interface if we haven't done it yet
        try {
            final JDefinedClass fieldInterface = clazz._interface(interfaceFQN.substring(interfaceFQN.lastIndexOf('.') + 1));
            fieldInterface._extends(Serializable.class);
        } catch (JClassAlreadyExistsException e) {
            throw new RuntimeException(e);
        }
        annotateIfNotDone(clazz, ClassWithInterfaceFieldsDeserializer.class);
    }
}
 
源代码2 项目: roboslack   文件: Attachment.java
/**
 * The {@link Color} to display on the sidebar next to the {@link Attachment}.
 *
 * @return an {@link Optional} containing a {@link Color}
 * @see Color
 */
@Value.Default
@Nullable
@JsonUnwrapped
public Color color() {
    return null;
}
 
源代码3 项目: roboslack   文件: Attachment.java
/**
 * The {@link Author} for this {@link Attachment}. It is displayed in a small grayed-out section at the top
 * before the main {@link Attachment} body.
 *
 * @return an {@link Optional} containing the {@link Author}
 */
@Value.Default
@Nullable
@JsonUnwrapped
public Author author() {
    return null;
}
 
源代码4 项目: roboslack   文件: Attachment.java
/**
 * The {@link Title} for this {@link Attachment}. It is displayed as larger, bold text near the top before the main
 * {@link Attachment} body.
 *
 * @return an {@link Optional} containing the {@link Title}
 */
@Value.Default
@Nullable
@JsonUnwrapped
public Title title() {
    return null;
}
 
源代码5 项目: roboslack   文件: Attachment.java
/**
 * The {@link Footer} for this {@link Attachment}. This will appear below the body of the main message
 * {@link Attachment} in smaller, grayed-out text.
 *
 * @return an {@link Optional} containing the {@link Footer}
 */
@Value.Default
@Nullable
@JsonUnwrapped
public Footer footer() {
    return null;
}
 
源代码6 项目: rest-schemagen   文件: SchemaPropertyGenerator.java
private void addFieldToMap(Field field, ObjectContext objectContext,
                           Map<Field, ObjectContext> fieldContextMap, Set<Type> unwrappedTypes,
                           SchemaPropertyContext context) {
    if (objectContext.isApplicable(field, context)) {
        if (field.getAnnotation(JsonUnwrapped.class) != null) {
            fieldContextMap.putAll(getUnwrappedFieldsMap(field, objectContext, unwrappedTypes,
                    context));
        } else {
            fieldContextMap.put(field, objectContext);
        }
    }
}
 
源代码7 项目: syndesis   文件: ResourceSpec.java
@JsonUnwrapped
@Nullable
DataSpec getDataSpec();
 
源代码8 项目: syndesis   文件: SourceSpec.java
@JsonUnwrapped
@Nullable
DataSpec getDataSpec();
 
源代码9 项目: curiostack   文件: StackdriverJsonLayout.java
@Override
@JsonUnwrapped
@JsonIgnoreProperties("message")
public Object getLogEvent() {
  return super.getLogEvent();
}
 
源代码10 项目: sctalk   文件: BaseUnwrappedModel.java
/**
 * @return the data
 */
@JsonUnwrapped
public T getData() {
    return data;
}
 
源代码11 项目: sctalk   文件: BaseUnwrappedModel.java
/**
 * @param data the data to set
 */
@JsonUnwrapped
public void setData(T data) {
    this.data = data;
}
 
源代码12 项目: dremio-oss   文件: UserForm.java
@JsonUnwrapped
public User getUserConfig() {
  return userConfig;
}
 
源代码13 项目: timely   文件: Metric.java
@JsonUnwrapped
public Value getValue() {
    return value;
}
 
源代码14 项目: restdocs-wiremock   文件: NestedContentResource.java
@JsonUnwrapped
public Resources<T> getNested() {
	return this.nested;
}
 
源代码15 项目: moserp   文件: HateoasResource.java
@JsonUnwrapped
public T getContent() {
    return content;
}
 
源代码16 项目: weixin-sdk   文件: Departments.java
@JsonProperty("department")
@JsonUnwrapped
public List<Department> getDepartments() {
    return departments;
}
 
@JsonInclude(NON_EMPTY)
@JsonUnwrapped
public Resources<EmbeddedWrapper> getEmbeddedResources() {
    return new Resources(embedded);
}
 
@JsonUnwrapped
@XmlAnyElement
public T getContent() {
    return content;
}
 
源代码19 项目: gwt-jackson   文件: PropertyProcessor.java
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() );
}
 
源代码20 项目: buck   文件: UnconfiguredTargetNodeWithDeps.java
@JsonUnwrapped
UnconfiguredTargetNode getUnconfiguredTargetNode();
 
源代码21 项目: keycloak   文件: ScriptProviderDescriptor.java
@JsonUnwrapped
@JsonGetter
public Map<String, List<ScriptProviderMetadata>> getProviders() {
    return providers;
}
 
源代码22 项目: logging-log4j2   文件: YamlLayout.java
@Override
@JsonUnwrapped
@JsonSerialize(as = LogEvent.class)
public LogEvent getLogEvent() {
    return super.getLogEvent();
}
 
源代码23 项目: logging-log4j2   文件: AbstractJacksonLayout.java
@JsonUnwrapped
public Object getLogEvent() {
    return logEvent;
}
 
源代码24 项目: logging-log4j2   文件: JsonLayout.java
@Override
@JsonUnwrapped
@JsonSerialize(as = LogEvent.class)
public LogEvent getLogEvent() {
    return super.getLogEvent();
}
 
 同包方法