本文整理汇总了Java中com.fasterxml.jackson.annotation.JsonIgnoreProperties类的典型用法代码示例。如果您正苦于以下问题:Java JsonIgnoreProperties类的具体用法?Java JsonIgnoreProperties怎么用?Java JsonIgnoreProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JsonIgnoreProperties类属于com.fasterxml.jackson.annotation包,在下文中一共展示了JsonIgnoreProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1:
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
@JsonCreator
@JsonIgnoreProperties(ignoreUnknown=true)
TaskAssignmentResult(@JsonProperty("avm") AssignableVirtualMachine avm,
@JsonProperty("request") TaskRequest request,
@JsonProperty("successful") boolean successful,
@JsonProperty("failures") List<AssignmentFailure> failures,
@JsonProperty("constraintFailure") ConstraintFailure constraintFailure,
@JsonProperty("fitness") double fitness) {
this.avm = avm;
this.request = request;
this.taskId = request.getId();
this.hostname = avm==null? "":avm.getHostname();
this.successful = successful;
this.failures = failures;
this.constraintFailure = constraintFailure;
this.fitness = fitness;
assignedPorts = new ArrayList<>();
rSets = new ArrayList<>();
}
示例2: getIgnoredProperties
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
private void getIgnoredProperties(ClassInformation information, ReflectClass<?> cls) {
JsonIgnoreProperties annot = cls.getAnnotation(JsonIgnoreProperties.class);
if (annot == null) {
return;
}
for (String name : annot.value()) {
PropertyInformation property = information.properties.get(name);
if (property == null) {
property = new PropertyInformation();
property.name = name;
information.properties.put(name, property);
}
property.ignored = true;
}
}
示例3: getAllOffersByTask
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
/**
* This method returns a list with all ids of offers that contain a specific task. This is irrespective
* of the marketplace.
*
* @param taskId
* The id of the task, which all returned offers contain.
* @param apiKey
* The valid query parameter API key affiliated to one specific organisation,
* to which the offer belongs to.
* @return A list of all offers' ids that contain the task with the passed id as a list.
*/
@GET
@Path("/offers/{taskId}/*")
@TypeHint(Integer[].class)
@JsonIgnoreProperties({ "player" })
public Response getAllOffersByTask(
@PathParam("taskId") @NotNull @ValidPositiveDigit(message = "The task id must be a valid number") String taskId,
@QueryParam("apiKey") @ValidApiKey String apiKey) {
int idTask = ValidateUtils.requireGreaterThanZero(taskId);
Task task = taskDao.getTask(idTask, apiKey);
List<Offer> offers = marketPlDao.getOffersByTask(task, apiKey);
List<Integer> matchingOffers = new ArrayList<>();
for (Offer offer : offers) {
LOGGER.debug("| Offer:" + offer.getId());
matchingOffers.add(offer.getId());
}
return ResponseSurrogate.of(matchingOffers);
}
示例4: getAllMarketPlaceOffersByTask
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
/**
* This method returns a list with all offers which contain a specific task and the id of the
* offer's marketplace.
*
* @param taskId
* The id of the task, which all returned offers contain.
* @param apiKey
* The valid query parameter API key affiliated to one specific organisation,
* to which the offer belongs to.
* @return A list of all offers and their marketplaces which contain the task with the
* passed id as a list.
*/
@GET
@Path("/offers/{taskId}/market/*")
@TypeHint(Offer[].class)
@JsonIgnoreProperties({ "player" })
public Response getAllMarketPlaceOffersByTask(
@PathParam("taskId") @NotNull @ValidPositiveDigit(message = "The task id must be a valid number") String taskId,
@QueryParam("apiKey") @ValidApiKey String apiKey) {
int idTask = ValidateUtils.requireGreaterThanZero(taskId);
Task task = taskDao.getTask(idTask, apiKey);
ArrayList<OfferMarketPlace> offList = MarketPlace.getAllOfferMarketPlaces(marketPlDao, task, apiKey);
return ResponseSurrogate.of(offList);
}
示例5: getAsJson
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
@JsonIgnoreProperties
public String getAsJson(Tweet tweet) {
ObjectMapper mapper = new ObjectMapper();
String result = "";
try {
result = mapper.writeValueAsString(tweet);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return result;
}
示例6: ConstraintFailure
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
@JsonCreator
@JsonIgnoreProperties(ignoreUnknown=true)
public ConstraintFailure(@JsonProperty("name") String name, @JsonProperty("reason") String reason) {
this.name = name;
this.reason = reason;
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
示例7: AssignmentFailure
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
@JsonCreator
@JsonIgnoreProperties(ignoreUnknown=true)
public AssignmentFailure(@JsonProperty("resource") VMResource resource,
@JsonProperty("asking") double asking,
@JsonProperty("used") double used,
@JsonProperty("available") double available,
@JsonProperty("message") String message
) {
this.resource = resource;
this.asking = asking;
this.used = used;
this.available = available;
this.message = message;
}
示例8: ConsumeResult
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
@JsonCreator
@JsonIgnoreProperties(ignoreUnknown=true)
public ConsumeResult(@JsonProperty("index") int index,
@JsonProperty("attrName") String attrName,
@JsonProperty("resName") String resName,
@JsonProperty("fitness") double fitness) {
this.index = index;
this.attrName = attrName;
this.resName = resName;
this.fitness = fitness;
}
示例9: of
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonCreator
public static GroupMessage of( //
@JsonProperty("_id") final String id, //
@JsonProperty("_from") final String groupId, //
@JsonProperty("participant") final String senderPhone, //
@JsonProperty(value = "notify", required = false) final String senderName, //
@JsonProperty(value = "body", required = false) final String text) {
return new GroupMessage(escapeDot(id), escapeDot(groupId), escapeDot(senderPhone), senderName, text == null ? "" : text);
}
示例10: annotatedWithIgnore
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
/**
* Returns a boolean indicating whether the provided field is annotated with
* some form of ignore. This method is memoized to speed up execution time
*/
boolean annotatedWithIgnore(Field f) {
return memoizer.ignoreAnnotations(f, () -> {
JsonIgnore jsonIgnore = getAnnotation(f, JsonIgnore.class);
JsonIgnoreProperties classIgnoreProperties = getAnnotation(f.getDeclaringClass(), JsonIgnoreProperties.class);
JsonIgnoreProperties fieldIgnoreProperties = null;
boolean backReferenced = false;
//make sure the referring field didn't specify properties to ignore
if(referringField != null) {
fieldIgnoreProperties = getAnnotation(referringField, JsonIgnoreProperties.class);
}
//make sure the referring field didn't specify a backreference annotation
if(getAnnotation(f, JsonBackReference.class) != null && referringField != null) {
for(Field lastField : getDeclaredFields(referringField.getDeclaringClass())) {
JsonManagedReference fieldManagedReference = getAnnotation(lastField, JsonManagedReference.class);
if(fieldManagedReference != null && lastField.getType().equals(f.getDeclaringClass())) {
backReferenced = true;
break;
}
}
}
return (jsonIgnore != null && jsonIgnore.value()) ||
(classIgnoreProperties != null && Arrays.asList(classIgnoreProperties.value()).contains(f.getName())) ||
(fieldIgnoreProperties != null && Arrays.asList(fieldIgnoreProperties.value()).contains(f.getName())) ||
backReferenced;
});
}
示例11: findIgnoreUnknownProperties
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
public Boolean findIgnoreUnknownProperties(AnnotatedClass paramAnnotatedClass)
{
JsonIgnoreProperties localJsonIgnoreProperties = (JsonIgnoreProperties)paramAnnotatedClass.getAnnotation(JsonIgnoreProperties.class);
if (localJsonIgnoreProperties == null)
return null;
return Boolean.valueOf(localJsonIgnoreProperties.ignoreUnknown());
}
示例12: findPropertiesToIgnore
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
public String[] findPropertiesToIgnore(Annotated paramAnnotated)
{
JsonIgnoreProperties localJsonIgnoreProperties = (JsonIgnoreProperties)paramAnnotated.getAnnotation(JsonIgnoreProperties.class);
if (localJsonIgnoreProperties == null)
return null;
return localJsonIgnoreProperties.value();
}
示例13: PaymentResponse
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonCreator
public PaymentResponse(@JsonProperty("id") String id,
@JsonProperty("score") Integer score,
@JsonProperty("type") String type,
@JsonProperty("likelyFraud") Boolean likelyFraud,
@JsonProperty("baseRisk") Double baseRisk,
@JsonProperty("explanation") List<Explanation> explanation) {
this.id = id;
this.score = score;
this.type = type;
this.likelyFraud = likelyFraud;
this.baseRisk = baseRisk;
this.explanation = explanation;
}
示例14: getParticipants
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
@JsonIgnoreProperties({"pw", "email", "name", "devices", "lastModified", "created"})
public ArrayList<User> getParticipants() {
if (participants == null) {
participants = new ArrayList<>();
User mDummy = new User("Dummy", 12);
participants.add(mDummy);
// Without cast IntelliJ is not happy
Log.e(((Object) this).getClass().getSimpleName(), "Participants are null");
}
return new ArrayList<User>(participants);
}
示例15: getOwner
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; //导入依赖的package包/类
@JsonIgnoreProperties({"pw", "email", "name", "devices", "lastModified", "created"})
public User getOwner() {
if (owner == null) {
owner = new User("Dummy", 12);
}
return owner;
}