flexjson.JSONSerializer.exclude()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中flexjson.JSONSerializer.exclude()方法的一些代码示例,展示了JSONSerializer.exclude()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONSerializer.exclude()方法的具体详情如下:
包路径:flexjson.JSONSerializer
类名称:JSONSerializer
方法名:exclude

JSONSerializer.exclude介绍

[英]This takes in a dot expression representing fields to exclude when serialize method is called. You can hand it one or more fields. Example are: "password", "bankaccounts.number", "people.socialsecurity", or "people.medicalHistory". In exclude method dot notations will only exclude the final field (i.e. rightmost field). All the fields to the left of the last field will be included. In order to exclude the medicalHistory field we have to include the people field since people would've been excluded anyway since it's a Collection of Person objects. The order of evaluation is the order in which you call the exclude method. The first call to exclude will be evaluated before other calls to include or exclude. The field expressions are evaluated in order you pass to this method.
[中]这将接受一个点表达式,表示调用serialize方法时要排除的字段。您可以将一个或多个字段交给它。例如:“密码”、“银行帐户.号码”、“人员.社会安全”或“人员.医疗历史”。在排除方法中,点符号仅排除最终字段(即最右边的字段)。将包括最后一个字段左侧的所有字段。为了排除medicalHistory字段,我们必须包括people字段,因为people是Person对象的集合,所以无论如何都会被排除。求值顺序是调用排除方法的顺序。要排除的第一个调用将在要包括或排除的其他调用之前进行计算。字段表达式按传递给此方法的顺序计算。

代码示例

代码示例来源:origin: spring-projects/spring-integration-samples

public static String toJsonArray(Collection<LoanShark> collection) {
  return new JSONSerializer().exclude("*.class").serialize(collection);
}

代码示例来源:origin: spring-projects/spring-integration-samples

public String toJson() {
  return new JSONSerializer().exclude("*.class").serialize(this);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJsonArray.
 * @param collection Collection<Thermodock>
 * @return String
 */
public static final String toJsonArray(
    final Collection<Thermodock> collection) {
  return new JSONSerializer().exclude("*.class").exclude("active")
      .exclude("updatedDate").exclude("version").exclude("id")
      .serialize(collection);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJsonArray.
 * @param collection Collection<com.medisanaspace.model.TrackerPhase>
 * @return String
 */
public static String toJsonArray(
    Collection<com.medisanaspace.model.TrackerPhase> collection) {
  return new JSONSerializer().exclude("*.class").exclude("active")
      .exclude("updatedDate").exclude("version").exclude("id")
      .serialize(collection);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJsonArray.
 * @param collection Collection<Glucodockglucose>
 * @return String
 */
public static final String toJsonArray(
    final Collection<Glucodockglucose> collection) {
  return new JSONSerializer().exclude("*.class").exclude("active")
      .exclude("updatedDate").exclude("version").exclude("id")
      .serialize(collection);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJsonArray.
 * @param collection Collection<Cardiodock>
 * @return String
 */
public static final String toJsonArray(
    final Collection<Cardiodock> collection) {
  return new JSONSerializer().exclude("*.class").exclude("active")
      .exclude("updatedDate").exclude("version").exclude("id")
      .serialize(collection);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJsonArray.
 * @param collection Collection<UserSettings>
 * @return String
 */
public static final String toJsonArray(
    final Collection<UserSettings> collection) {
  return new JSONSerializer().exclude("*.class").exclude("active")
      .exclude("updatedDate").exclude("version").exclude("id")
      .serialize(collection);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJsonArray.
 * @param collection Collection<TrackerSleep>
 * @return String
 */
public static final String toJsonArray(
    final Collection<TrackerSleep> collection) {
  return new JSONSerializer().include("trackerSleepQualities").exclude("*.class")
      .exclude("active").exclude("updatedDate").exclude("version")
      .exclude("uuid").serialize(collection);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJsonArray.
 * @param collection Collection<Activitydock>
 * @return String
 */
public static final String toJsonArray(final Collection<Activitydock> collection) {
  return new JSONSerializer().include("activities", "distances")
      .exclude("*.class").exclude("active").exclude("updatedDate")
      .exclude("version").exclude("id").serialize(collection);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJsonArray.
 * @param collection Collection<TrackerActivity>
 * @return String
 */
public static final String toJsonArray(
    final Collection<TrackerActivity> collection) {
  return new JSONSerializer().include("trackerActivityEntries")
      .exclude("*.class").exclude("active").exclude("updatedDate")
      .exclude("version").exclude("uuid").serialize(collection);
}

代码示例来源:origin: org.motechproject/motech-server-core

@Override
  public String toString() {
    return new JSONSerializer().exclude("childLocations").serialize(this).replaceAll("\"","'");
  }
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJson.
 * @return String
 */
public final String toJson() {
  return new JSONSerializer().exclude("*.class").serialize(this);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJson.
 * @return String
 */
public final String toJson() {
  return new JSONSerializer().exclude("*.class").serialize(this);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJson.
 * @return String
 */
public final String toJson() {
  return new JSONSerializer().exclude("*.class").serialize(this);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJson.
 * @return String
 */
public final String toJson() {
  return new JSONSerializer().exclude("*.class").serialize(this);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJson.
 * @return String
 */
public final String toJson() {
  return new JSONSerializer().exclude("*.class").serialize(this);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJsonArray.
 * @param collection Collection<Activity>
 * @return String
 */
public static final String toJsonArray(final Collection<Activity> collection) {
  return new JSONSerializer().exclude("*.class").serialize(collection);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJson.
 * @return String
 */
public final String toJson() {
  return new JSONSerializer().exclude("*.class").serialize(this);
}

代码示例来源:origin: Medisana/vitadock-api

/**
 * Method toJson.
 * @return String
 */
public final String toJson() {
  return new JSONSerializer().exclude("*.class").serialize(this);
}

代码示例来源:origin: fabienrenaud/java-json-benchmark

@Benchmark
@Override
public Object flexjson() {
  StringBuilder b = JsonUtils.stringBuilder();
  JSON_SOURCE().provider().flexjsonSer().exclude("*.class").deepSerialize(JSON_SOURCE().nextPojo(), b);
  return b;
}

相关文章