com.fasterxml.jackson.annotation.JsonAlias Java Examples

The following examples show how to use com.fasterxml.jackson.annotation.JsonAlias. 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: AnnotationBasedIntrospector.java    From jackson-jr with Apache License 2.0 6 votes vote down vote up
private static Set<String> _collectAliases(APropAccessor<?> acc, Set<String> collectedAliases) {
    if (acc != null) {
        AnnotatedElement accOb = acc.accessor;
        if (accOb != null) {
            JsonAlias ann = accOb.getAnnotation(JsonAlias.class);
            if (ann != null) {
                final String[] names = ann.value();
                if (collectedAliases == null) {
                    collectedAliases = new HashSet<String>();
                }
                for (String alias : names) {
                    collectedAliases.add(alias);
                }
            }
        }
    }
    return collectedAliases;
}
 
Example #2
Source File: HubMetadataConfiguration.java    From verify-service-provider with MIT License 6 votes vote down vote up
@JsonCreator
public HubMetadataConfiguration(
        @JsonProperty("uri") @JsonAlias({"url"}) URI uri,
        @JsonProperty("minRefreshDelay") Long minRefreshDelay,
        @JsonProperty("maxRefreshDelay") Long maxRefreshDelay,
        @JsonProperty("expectedEntityId") String expectedEntityId,
        @JsonProperty("client") JerseyClientConfiguration client,
        @JsonProperty("jerseyClientName") String jerseyClientName,
        @JsonProperty("hubFederationId") String hubFederationId,
        @JsonProperty("trustStore") TrustStoreConfiguration trustStoreConfiguration,
        @JsonProperty("hubTrustStore") TrustStoreConfiguration hubTrustStoreConfiguration,
        @JsonProperty("idpTrustStore") TrustStoreConfiguration idpTrustStoreConfiguration) {
    super(uri, minRefreshDelay, maxRefreshDelay, expectedEntityId, client,
            ofNullable(jerseyClientName).orElse(HUB_JERSEY_CLIENT_NAME), hubFederationId);
    this.trustStoreConfiguration = trustStoreConfiguration;
    this.hubTrustStoreConfiguration = hubTrustStoreConfiguration;
    this.idpTrustStoreConfiguration = idpTrustStoreConfiguration;
}
 
Example #3
Source File: ResequenceStepParser.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
@JsonAlias("stream-config")
public void setStreamConfig(StreamResequencerConfig config) {
    if (getResequencerConfig() != null) {
        throw new IllegalArgumentException("And resequencer config has already been set");
    }
    setResequencerConfig(config);
}
 
Example #4
Source File: ResequenceStepParser.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
@JsonAlias("batch-config")
public void setBatchConfig(BatchResequencerConfig config) {
    if (getResequencerConfig() != null) {
        throw new IllegalArgumentException("And resequencer config has already been set");
    }
    setResequencerConfig(config);
}
 
Example #5
Source File: LoadBalanceStepParser.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
@JsonAlias("roundRobin")
public  void setRoundRobin(RoundRobinLoadBalancerDefinition definition) {
    if (getLoadBalancerType() != null) {
        throw new IllegalArgumentException("A load-balancer has already been set");
    }
    setLoadBalancerType(definition);
}
 
Example #6
Source File: LoadBalanceStepParser.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
@JsonAlias("weighted")
public  void setWeighted(WeightedLoadBalancerDefinition definition) {
    if (getLoadBalancerType() != null) {
        throw new IllegalArgumentException("A load-balancer has already been set");
    }
    setLoadBalancerType(definition);
}
 
Example #7
Source File: LoadBalanceStepParser.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
@JsonAlias("topic")
public  void setTopic(TopicLoadBalancerDefinition definition) {
    if (getLoadBalancerType() != null) {
        throw new IllegalArgumentException("A load-balancer has already been set");
    }
    setLoadBalancerType(definition);
}
 
Example #8
Source File: LoadBalanceStepParser.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
@JsonAlias("sticky")
public  void setSticky(Sticky definition) {
    if (getLoadBalancerType() != null) {
        throw new IllegalArgumentException("A load-balancer has already been set");
    }
    setLoadBalancerType(definition);
}
 
Example #9
Source File: LoadBalanceStepParser.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
@JsonAlias("failover")
public  void setFailover(FailoverLoadBalancerDefinition definition) {
    if (getLoadBalancerType() != null) {
        throw new IllegalArgumentException("A load-balancer has already been set");
    }
    setLoadBalancerType(definition);
}
 
Example #10
Source File: MsaMetadataConfiguration.java    From verify-service-provider with MIT License 5 votes vote down vote up
@JsonCreator
public MsaMetadataConfiguration(
        @JsonProperty("uri") @JsonAlias({ "url" }) URI uri,
        @JsonProperty("minRefreshDelay") Long minRefreshDelay,
        @JsonProperty("maxRefreshDelay") Long maxRefreshDelay,
        @JsonProperty(value = "expectedEntityId", required = true) String expectedEntityId,
        @JsonProperty("client") JerseyClientConfiguration client,
        @JsonProperty("jerseyClientName") String jerseyClientName,
        @JsonProperty("hubFederationId") String hubFederationId
) {
    super(uri, minRefreshDelay, maxRefreshDelay, expectedEntityId, client, ofNullable(jerseyClientName).orElse(MSA_JERSEY_CLIENT_NAME), hubFederationId);
}
 
Example #11
Source File: LoadBalanceStepParser.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
@JsonAlias({"customLoadBalancer", "custom"})
public  void setCustomLoadBalancer(CustomLoadBalancerDefinition definition) {
    if (getLoadBalancerType() != null) {
        throw new IllegalArgumentException("A load-balancer has already been set");
    }
    setLoadBalancerType(definition);
}
 
Example #12
Source File: LoadBalanceStepParser.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
@JsonAlias("random")
public void setRandom(RandomLoadBalancerDefinition definition) {
    if (getLoadBalancerType() != null) {
        throw new IllegalArgumentException("A load-balancer has already been set");
    }
    setLoadBalancerType(definition);
}
 
Example #13
Source File: LoadBalanceStepParser.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
@JsonAlias({"load-balancer-type", "type"})
@JsonTypeInfo(
    use = JsonTypeInfo.Id.NAME,
    include = JsonTypeInfo.As.WRAPPER_OBJECT
)
@Override
public void setLoadBalancerType(LoadBalancerDefinition loadbalancer) {
    super.setLoadBalancerType(loadbalancer);
}
 
Example #14
Source File: GenerateYamlParserSupportClasses.java    From camel-k-runtime with Apache License 2.0 4 votes vote down vote up
public final TypeSpec generateHasLoadBalancerType() {
    TypeSpec.Builder type = TypeSpec.interfaceBuilder("HasLoadBalancerType");
    type.addModifiers(Modifier.PUBLIC);
    type.addMethod(
        MethodSpec.methodBuilder("setLoadBalancerType")
            .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
            .addParameter(LoadBalancerDefinition.class, "loadbalancer")
            .addAnnotation(
                AnnotationSpec.builder(JsonTypeInfo.class)
                    .addMember("use", "$L", "JsonTypeInfo.Id.NAME")
                    .addMember("include", "$L", "JsonTypeInfo.As.WRAPPER_OBJECT")
                    .build())
            .build()
    );

    type.addMethod(
        MethodSpec.methodBuilder("getLoadBalancerType")
            .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
            .returns(LoadBalancerDefinition.class)
            .build()
    );

    definitions(LOAD_BALANCE_DEFINITION_CLASS).forEach(
        (k, v) -> {
            String name = k;
            name = WordUtils.capitalize(name, '_', '-');
            name = StringUtils.remove(name, "_");
            name = StringUtils.remove(name, "-");

            type.addMethod(MethodSpec.methodBuilder("set" + name)
                .addAnnotation(
                    AnnotationSpec.builder(JsonAlias.class).addMember("value", "$S", k).build())
                .addModifiers(Modifier.PUBLIC, Modifier.DEFAULT)
                .addParameter(v, "definition")
                .addCode(
                    CodeBlock.builder()
                        .beginControlFlow("if (getLoadBalancerType() != null)")
                        .addStatement("throw new IllegalArgumentException(\"A load-balancer has already been set\")")
                        .endControlFlow()
                        .addStatement("setLoadBalancerType(definition);").build())
                .build()
            );
        }
    );

    return type.build();
}
 
Example #15
Source File: APICorsConfigurationDTO.java    From product-microgateway with Apache License 2.0 4 votes vote down vote up
@JsonAlias({"accessControlAllowCredentials", "access_control_allow_credentials",
        "access-control-allow-credentials"})
public Boolean getAccessControlAllowCredentials() {
    return accessControlAllowCredentials;
}
 
Example #16
Source File: GenerateYamlParserSupportClasses.java    From camel-k-runtime with Apache License 2.0 4 votes vote down vote up
public final TypeSpec generateHasDataFormat() {
    TypeSpec.Builder type = TypeSpec.interfaceBuilder("HasDataFormat");
    type.addModifiers(Modifier.PUBLIC);
    type.addMethod(
        MethodSpec.methodBuilder("setDataFormatType")
            .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
            .addParameter(DataFormatDefinition.class, "dataFormatType")
            .addAnnotation(
                AnnotationSpec.builder(JsonAlias.class).
                    addMember("value", "{$S, $S}", "data-format-type", "data-format")
                    .build())
            .addAnnotation(
                AnnotationSpec.builder(JsonTypeInfo.class)
                    .addMember("use", "$L", "JsonTypeInfo.Id.NAME")
                    .addMember("include", "$L", "JsonTypeInfo.As.WRAPPER_OBJECT")
                    .build())
            .build()
    );

    type.addMethod(
        MethodSpec.methodBuilder("getDataFormatType")
            .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
            .returns(DataFormatDefinition.class)
            .build()
    );

    definitions(DATAFORMAT_DEFINITION_CLASS).forEach(
        (k, v) -> {
            String name = k;
            name = WordUtils.capitalize(name, '_', '-');
            name = StringUtils.remove(name, "_");
            name = StringUtils.remove(name, "-");

            type.addMethod(MethodSpec.methodBuilder("set" + name)
                .addAnnotation(
                    AnnotationSpec.builder(JsonAlias.class).addMember("value", "$S", k).build())
                .addModifiers(Modifier.PUBLIC, Modifier.DEFAULT)
                .addParameter(v, "definition")
                .addCode(
                    CodeBlock.builder()
                        .beginControlFlow("if (getDataFormatType() != null)")
                        .addStatement("throw new IllegalArgumentException(\"A data format has already been set\")")
                        .endControlFlow()
                        .addStatement("setDataFormatType(definition);")
                        .build())
                .build()
            );
        }
    );

    return type.build();
}
 
Example #17
Source File: GenerateYamlParserSupportClasses.java    From camel-k-runtime with Apache License 2.0 4 votes vote down vote up
public final TypeSpec generateHasExpression() {
    TypeSpec.Builder type = TypeSpec.interfaceBuilder("HasExpression");
    type.addModifiers(Modifier.PUBLIC);
    type.addMethod(
        MethodSpec.methodBuilder("setExpression")
            .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
            .addParameter(ExpressionDefinition.class, "expressionDefinition")
            .addAnnotation(
                AnnotationSpec.builder(JsonTypeInfo.class)
                    .addMember("use", "$L", "JsonTypeInfo.Id.NAME")
                    .addMember("include", "$L", "JsonTypeInfo.As.WRAPPER_OBJECT")
                    .build())
            .build()
    );

    type.addMethod(
        MethodSpec.methodBuilder("getExpression")
            .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
            .returns(ExpressionDefinition.class)
            .build()
    );

    definitions(EXPRESSION_DEFINITION_CLASS).forEach(
        (k, v) -> {
            String name = k;
            name = WordUtils.capitalize(name, '_', '-');
            name = StringUtils.remove(name, "_");
            name = StringUtils.remove(name, "-");

            type.addMethod(MethodSpec.methodBuilder("set" + name)
                .addAnnotation(
                    AnnotationSpec.builder(JsonAlias.class).addMember("value", "$S", k).build())
                .addModifiers(Modifier.PUBLIC, Modifier.DEFAULT)
                .addParameter(v, "definition")
                .addCode(
                    CodeBlock.builder()
                        .beginControlFlow("if (getExpression() != null)")
                        .addStatement("throw new IllegalArgumentException(\"And expression has already been set\")")
                        .endControlFlow()
                        .addStatement("setExpression(definition);").build())
                .build()
            );
        }
    );

    return type.build();
}
 
Example #18
Source File: RemovePropertyDefinitionMixIn.java    From camel-k-runtime with Apache License 2.0 4 votes vote down vote up
@JsonAlias({"name", "property-name"})
public abstract String getPropertyName();
 
Example #19
Source File: RemovePropertyDefinitionMixIn.java    From camel-k-runtime with Apache License 2.0 4 votes vote down vote up
@JsonAlias({"name", "property-name"})
public abstract void setPropertyName(String headerName);
 
Example #20
Source File: APICorsConfigurationDTO.java    From product-microgateway with Apache License 2.0 4 votes vote down vote up
@JsonAlias({"accessControlAllowOrigins", "access_control_allow_origins", "access-control-allow-origins"})
public List<String> getAccessControlAllowOrigins() {
    return accessControlAllowOrigins;
}
 
Example #21
Source File: BasicAliasTest.java    From jackson-jr with Apache License 2.0 4 votes vote down vote up
@JsonAlias({ "lastName", "ln" })
public void setLast(String str) { last = str; }
 
Example #22
Source File: APICorsConfigurationDTO.java    From product-microgateway with Apache License 2.0 4 votes vote down vote up
@JsonAlias("corsConfigurationEnabled")
public Boolean getCorsConfigurationEnabled() {
    return corsConfigurationEnabled;
}
 
Example #23
Source File: APICorsConfigurationDTO.java    From product-microgateway with Apache License 2.0 4 votes vote down vote up
@JsonAlias({"accessControlAllowHeaders", "access_control_allow_headers", "access-control-allow-headers"})
public List<String> getAccessControlAllowHeaders() {
    return accessControlAllowHeaders;
}
 
Example #24
Source File: APICorsConfigurationDTO.java    From product-microgateway with Apache License 2.0 4 votes vote down vote up
@JsonAlias({"accessControlAllowMethods", "access_control_allow_methods", "access-control-allow-methods"})
public List<String> getAccessControlAllowMethods() {
    return accessControlAllowMethods;
}
 
Example #25
Source File: CpDataDeserializationMixin.java    From hj-t212-parser with Apache License 2.0 4 votes vote down vote up
@JsonAlias({ "Ctime", "cTime" })
abstract void setcTime(int cTime);
 
Example #26
Source File: CreatedUser.java    From auth0-java with MIT License 4 votes vote down vote up
@JsonProperty("_id")
@JsonAlias({"_id", "id", "user_id"})
public String getUserId() {
    return userId;
}
 
Example #27
Source File: JobConfig.java    From jlineup with Apache License 2.0 4 votes vote down vote up
@JsonProperty("wait-after-page-load")
@JsonAlias({"async-wait"})
public Builder withGlobalWaitAfterPageLoad(float val) {
    globalWaitAfterPageLoad = val;
    return this;
}
 
Example #28
Source File: DeviceConfig.java    From jlineup with Apache License 2.0 4 votes vote down vote up
@JsonAlias("pixelRatio")
public Builder withPixelRatio(float val) {
    pixelRatio = val;
    return this;
}
 
Example #29
Source File: DeviceConfig.java    From jlineup with Apache License 2.0 4 votes vote down vote up
@JsonAlias("deviceName")
public Builder withDeviceName(String val) {
    deviceName = val;
    return this;
}
 
Example #30
Source File: DeviceConfig.java    From jlineup with Apache License 2.0 4 votes vote down vote up
@JsonAlias("userAgent")
public Builder withUserAgent(String val) {
    userAgent = val;
    return this;
}