类com.google.gson.annotations.Expose源码实例Demo

下面列出了怎么用com.google.gson.annotations.Expose的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: tencentcloud-sdk-java   文件: Model.java
/**
 * Internal implementation, normal users should not use it.
 */
public void toMap(HashMap<String, String> map, String prefix) {
    this.setParamSimple(map, prefix + "Name", this.Name);
    this.setParamSimple(map, prefix + "Description", this.Description);
    this.setParamSimple(map, prefix + "Cluster", this.Cluster);
    this.setParamSimple(map, prefix + "Model", this.Model);
    this.setParamSimple(map, prefix + "RuntimeVersion", this.RuntimeVersion);
    this.setParamSimple(map, prefix + "CreateTime", this.CreateTime);
    this.setParamSimple(map, prefix + "State", this.State);
    this.setParamSimple(map, prefix + "ServingUrl", this.ServingUrl);
    this.setParamSimple(map, prefix + "Message", this.Message);
    this.setParamSimple(map, prefix + "AppId", this.AppId);
    this.setParamSimple(map, prefix + "ServType", this.ServType);
    this.setParamSimple(map, prefix + "Expose", this.Expose);
    this.setParamSimple(map, prefix + "Replicas", this.Replicas);
    this.setParamSimple(map, prefix + "Id", this.Id);
    this.setParamSimple(map, prefix + "Uin", this.Uin);
    this.setParamSimple(map, prefix + "DelTime", this.DelTime);

}
 
源代码2 项目: cuba   文件: CubaJavaScriptComponent.java
protected static GsonBuilder createSharedGsonBuilder() {
    GsonBuilder builder = new GsonBuilder();
    builder.setExclusionStrategies(new ExclusionStrategy() {
        @Override
        public boolean shouldSkipField(FieldAttributes f) {
            Expose expose = f.getAnnotation(Expose.class);
            return expose != null && !expose.serialize();
        }

        @Override
        public boolean shouldSkipClass(Class<?> clazz) {
            return false;
        }
    });

    setDefaultProperties(builder);
    return builder;
}
 
/**
 * Internal implementation, normal users should not use it.
 */
public void toMap(HashMap<String, String> map, String prefix) {
    this.setParamSimple(map, prefix + "Name", this.Name);
    this.setParamSimple(map, prefix + "Model", this.Model);
    this.setParamSimple(map, prefix + "Description", this.Description);
    this.setParamSimple(map, prefix + "Cluster", this.Cluster);
    this.setParamSimple(map, prefix + "RuntimeVersion", this.RuntimeVersion);
    this.setParamSimple(map, prefix + "Replicas", this.Replicas);
    this.setParamSimple(map, prefix + "Expose", this.Expose);
    this.setParamSimple(map, prefix + "ServType", this.ServType);
    this.setParamArraySimple(map, prefix + "RuntimeConf.", this.RuntimeConf);

}
 
源代码4 项目: raml-java-tools   文件: GsonObjectExtension.java
@Override
public FieldSpec.Builder fieldBuilt(ObjectPluginContext objectPluginContext, TypeDeclaration declaration, FieldSpec.Builder incoming, EventType eventType) {
    return incoming
            .addAnnotation(
                    AnnotationSpec.builder(SerializedName.class)
                            .addMember("value", "$S", objectPluginContext.creationResult().getJavaName(EventType.IMPLEMENTATION)).build())
            .addAnnotation(AnnotationSpec.builder(Expose.class).build());
}
 
源代码5 项目: letv   文件: Excluder.java
public boolean excludeField(Field field, boolean serialize) {
    if ((this.modifiers & field.getModifiers()) != 0) {
        return true;
    }
    if (this.version != IGNORE_VERSIONS && !isValidVersion((Since) field.getAnnotation(Since.class), (Until) field.getAnnotation(Until.class))) {
        return true;
    }
    if (field.isSynthetic()) {
        return true;
    }
    if (this.requireExpose) {
        Expose annotation = (Expose) field.getAnnotation(Expose.class);
        if (annotation == null || (serialize ? !annotation.serialize() : !annotation.deserialize())) {
            return true;
        }
    }
    if (!this.serializeInnerClasses && isInnerClass(field.getType())) {
        return true;
    }
    if (isAnonymousOrLocal(field.getType())) {
        return true;
    }
    List<ExclusionStrategy> list = serialize ? this.serializationStrategies : this.deserializationStrategies;
    if (!list.isEmpty()) {
        FieldAttributes fieldAttributes = new FieldAttributes(field);
        for (ExclusionStrategy exclusionStrategy : list) {
            if (exclusionStrategy.shouldSkipField(fieldAttributes)) {
                return true;
            }
        }
    }
    return false;
}
 
/**
 * Internal implementation, normal users should not use it.
 */
public void toMap(HashMap<String, String> map, String prefix) {
    this.setParamObj(map, prefix + "Expose.", this.Expose);
    this.setParamSimple(map, prefix + "RequestId", this.RequestId);

}
 
源代码7 项目: java   文件: GsonCompatibilityMode.java
@Override
protected JsonIgnore getJsonIgnore(Annotation[] annotations) {

    JsonIgnore jsoniterObj = super.getJsonIgnore(annotations);
    if (jsoniterObj != null) {
        return jsoniterObj;
    }
    if (builder().excludeFieldsWithoutExposeAnnotation) {
        final Expose gsonObj = getAnnotation(
                annotations, Expose.class);
        if (gsonObj != null) {
            return new JsonIgnore() {
                @Override
                public boolean ignoreDecoding() {
                    return !gsonObj.deserialize();
                }

                @Override
                public boolean ignoreEncoding() {
                    return !gsonObj.serialize();
                }

                @Override
                public Class<? extends Annotation> annotationType() {
                    return JsonIgnore.class;
                }
            };
        }
        return new JsonIgnore() {
            @Override
            public boolean ignoreDecoding() {
                return true;
            }

            @Override
            public boolean ignoreEncoding() {
                return true;
            }

            @Override
            public Class<? extends Annotation> annotationType() {
                return JsonIgnore.class;
            }
        };
    }
    return null;
}
 
源代码8 项目: RoomBookerMVP   文件: JsonExclusionStrategy.java
@Override
public boolean shouldSkipField(FieldAttributes fieldAttributes) {
    final Expose expose = fieldAttributes.getAnnotation(Expose.class);
    return expose != null && !expose.serialize();
}
 
源代码9 项目: gson   文件: Excluder.java
public boolean excludeField(Field field, boolean serialize) {
  if ((modifiers & field.getModifiers()) != 0) {
    return true;
  }

  if (version != Excluder.IGNORE_VERSIONS
      && !isValidVersion(field.getAnnotation(Since.class), field.getAnnotation(Until.class))) {
    return true;
  }

  if (field.isSynthetic()) {
    return true;
  }

  if (requireExpose) {
    Expose annotation = field.getAnnotation(Expose.class);
    if (annotation == null || (serialize ? !annotation.serialize() : !annotation.deserialize())) {
      return true;
    }
  }

  if (!serializeInnerClasses && isInnerClass(field.getType())) {
    return true;
  }

  if (isAnonymousOrLocal(field.getType())) {
    return true;
  }

  List<ExclusionStrategy> list = serialize ? serializationStrategies : deserializationStrategies;
  if (!list.isEmpty()) {
    FieldAttributes fieldAttributes = new FieldAttributes(field);
    for (ExclusionStrategy exclusionStrategy : list) {
      if (exclusionStrategy.shouldSkipField(fieldAttributes)) {
        return true;
      }
    }
  }

  return false;
}
 
源代码10 项目: framework   文件: Excluder.java
public boolean excludeField(Field field, boolean serialize) {
  if ((modifiers & field.getModifiers()) != 0) {
    return true;
  }

  if (version != Excluder.IGNORE_VERSIONS
      && !isValidVersion(field.getAnnotation(Since.class), field.getAnnotation(Until.class))) {
    return true;
  }

  if (field.isSynthetic()) {
    return true;
  }

  if (requireExpose) {
    Expose annotation = field.getAnnotation(Expose.class);
    if (annotation == null || (serialize ? !annotation.serialize() : !annotation.deserialize())) {
      return true;
    }
  }

  if (!serializeInnerClasses && isInnerClass(field.getType())) {
    return true;
  }

  if (isAnonymousOrLocal(field.getType())) {
    return true;
  }

  List<ExclusionStrategy> list = serialize ? serializationStrategies : deserializationStrategies;
  if (!list.isEmpty()) {
    FieldAttributes fieldAttributes = new FieldAttributes(field);
    for (ExclusionStrategy exclusionStrategy : list) {
      if (exclusionStrategy.shouldSkipField(fieldAttributes)) {
        return true;
      }
    }
  }

  return false;
}
 
/**
 * Get 暴露方式 
 * @return Expose 暴露方式
 */
public ExposeInfo getExpose() {
    return this.Expose;
}
 
/**
 * Set 暴露方式
 * @param Expose 暴露方式
 */
public void setExpose(ExposeInfo Expose) {
    this.Expose = Expose;
}
 
源代码13 项目: tencentcloud-sdk-java   文件: Model.java
/**
 * Get 模型暴露方式 
 * @return Expose 模型暴露方式
 */
public String getExpose() {
    return this.Expose;
}
 
源代码14 项目: tencentcloud-sdk-java   文件: Model.java
/**
 * Set 模型暴露方式
 * @param Expose 模型暴露方式
 */
public void setExpose(String Expose) {
    this.Expose = Expose;
}
 
源代码15 项目: tencentcloud-sdk-java   文件: CreateModelRequest.java
/**
 * Get 暴露外网或内网,默认暴露外网,`集群模式` 选填 
 * @return Expose 暴露外网或内网,默认暴露外网,`集群模式` 选填
 */
public String getExpose() {
    return this.Expose;
}
 
源代码16 项目: tencentcloud-sdk-java   文件: CreateModelRequest.java
/**
 * Set 暴露外网或内网,默认暴露外网,`集群模式` 选填
 * @param Expose 暴露外网或内网,默认暴露外网,`集群模式` 选填
 */
public void setExpose(String Expose) {
    this.Expose = Expose;
}
 
 类所在包
 类方法
 同包方法