本文整理匯總了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;
}