下面列出了怎么用com.fasterxml.jackson.annotation.JsonAlias的API类实例代码及写法,或者点击链接到github查看源代码。
@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;
}
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;
}
@JsonAlias({"load-balancer-type", "type"})
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.WRAPPER_OBJECT
)
@Override
public void setLoadBalancerType(LoadBalancerDefinition loadbalancer) {
super.setLoadBalancerType(loadbalancer);
}
@JsonAlias("random")
public void setRandom(RandomLoadBalancerDefinition definition) {
if (getLoadBalancerType() != null) {
throw new IllegalArgumentException("A load-balancer has already been set");
}
setLoadBalancerType(definition);
}
@JsonAlias({"customLoadBalancer", "custom"})
public void setCustomLoadBalancer(CustomLoadBalancerDefinition definition) {
if (getLoadBalancerType() != null) {
throw new IllegalArgumentException("A load-balancer has already been set");
}
setLoadBalancerType(definition);
}
@JsonAlias("failover")
public void setFailover(FailoverLoadBalancerDefinition definition) {
if (getLoadBalancerType() != null) {
throw new IllegalArgumentException("A load-balancer has already been set");
}
setLoadBalancerType(definition);
}
@JsonAlias("sticky")
public void setSticky(Sticky definition) {
if (getLoadBalancerType() != null) {
throw new IllegalArgumentException("A load-balancer has already been set");
}
setLoadBalancerType(definition);
}
@JsonAlias("topic")
public void setTopic(TopicLoadBalancerDefinition definition) {
if (getLoadBalancerType() != null) {
throw new IllegalArgumentException("A load-balancer has already been set");
}
setLoadBalancerType(definition);
}
@JsonAlias("weighted")
public void setWeighted(WeightedLoadBalancerDefinition definition) {
if (getLoadBalancerType() != null) {
throw new IllegalArgumentException("A load-balancer has already been set");
}
setLoadBalancerType(definition);
}
@JsonAlias("roundRobin")
public void setRoundRobin(RoundRobinLoadBalancerDefinition definition) {
if (getLoadBalancerType() != null) {
throw new IllegalArgumentException("A load-balancer has already been set");
}
setLoadBalancerType(definition);
}
@JsonAlias("batch-config")
public void setBatchConfig(BatchResequencerConfig config) {
if (getResequencerConfig() != null) {
throw new IllegalArgumentException("And resequencer config has already been set");
}
setResequencerConfig(config);
}
@JsonAlias("stream-config")
public void setStreamConfig(StreamResequencerConfig config) {
if (getResequencerConfig() != null) {
throw new IllegalArgumentException("And resequencer config has already been set");
}
setResequencerConfig(config);
}
@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);
}
@JsonAlias("ground_control")
@JsonProperty(EXTENSION_PREFIX + ":ground_control")
Boolean getGroundControl();
@JsonAlias("item_type")
@JsonProperty(EXTENSION_PREFIX + ":item_type")
String getItemType();
@JsonAlias("provider")
@JsonProperty(EXTENSION_PREFIX + ":provider")
String getProvider();
@JsonAlias("published")
@JsonProperty(EXTENSION_PREFIX + ":published")
String getPublished();
@JsonAlias("quality_category")
@JsonProperty(EXTENSION_PREFIX + ":quality_category")
String getQualityCategory();
@JsonAlias("satellite_azimuth")
@JsonProperty(EXTENSION_PREFIX + ":satellite_azimuth")
Double getSatelliteAzimuth();
@JsonAlias("satellite_id")
@JsonProperty(EXTENSION_PREFIX + ":satellite_id")
String getSatelliteId();
@JsonAlias("strip_id")
@JsonProperty(EXTENSION_PREFIX + ":strip_id")
String getStripId();
@JsonAlias("updated")
@JsonProperty(EXTENSION_PREFIX + ":updated")
String getPlUpdated();
@Subcatalog
@Mapping(type = MappingType.KEYWORD)
@JsonAlias("wrs_path")
@JsonProperty(EXTENSION_PREFIX + ":wrs_path")
Integer getWrsPath();
@Subcatalog
@Mapping(type = MappingType.KEYWORD)
@JsonAlias("wrs_row")
@JsonProperty(EXTENSION_PREFIX + ":wrs_row")
Integer getWrsRow();
@JsonAlias("earth_sun_distance")
@JsonProperty(EXTENSION_PREFIX + ":earth_sun_distance")
Double getEarthSunDistance();
@JsonAlias("image_quality_oli")
@JsonProperty(EXTENSION_PREFIX + ":image_quality_oli")
Integer getImageQualityOli();
@JsonAlias("image_quality_tirs")
@JsonProperty(EXTENSION_PREFIX + ":image_quality_tirs")
Integer getImageQualityTirs();
@Mapping(type = MappingType.KEYWORD)
@JsonAlias("scene_id")
@JsonProperty(EXTENSION_PREFIX + ":scene_id")
String getSceneId();
@Mapping(type = MappingType.KEYWORD)
@JsonAlias("product_id")
@JsonProperty(EXTENSION_PREFIX + ":product_id")
String getProductId();
@Mapping(type = MappingType.KEYWORD)
@JsonAlias("processingLevel")
@JsonProperty(EXTENSION_PREFIX + ":processingLevel")
String getProcessingLevel();