org.apache.cloudstack.api.Parameter.expose()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(89)

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

Parameter.expose介绍

暂无

代码示例

代码示例来源:origin: apache/cloudstack

protected List<Field> getAllFieldsForClass(final Class<?> clazz) {
  List<Field> filteredFields = fieldsForCmdClass.get(clazz);
  // If list of fields was not cached yet
  if (filteredFields == null) {
    final List<Field> allFields = ReflectUtil.getAllFieldsForClass(this.getClass(), BaseCmd.class);
    filteredFields = new ArrayList<Field>();
    for (final Field field : allFields) {
      final Parameter parameterAnnotation = field.getAnnotation(Parameter.class);
      if ((parameterAnnotation != null) && parameterAnnotation.expose()) {
        filteredFields.add(field);
        }
      }
    // Cache the prepared list for future use
    fieldsForCmdClass.put(clazz, filteredFields);
        }
  return filteredFields;
      }

代码示例来源:origin: apache/cloudstack

for (Field field : fields) {
  Parameter parameterAnnotation = field.getAnnotation(Parameter.class);
  if ((parameterAnnotation == null) || !parameterAnnotation.expose()) {
    continue;

代码示例来源:origin: apache/cloudstack

for (Field f : fields) {
  Parameter parameterAnnotation = f.getAnnotation(Parameter.class);
  if (parameterAnnotation != null && parameterAnnotation.expose() && parameterAnnotation.includeInApiDoc()) {
    Argument reqArg = new Argument(parameterAnnotation.name());
    reqArg.setRequired(parameterAnnotation.required());

代码示例来源:origin: apache/cloudstack

private ApiDiscoveryResponse getCmdRequestMap(Class<?> cmdClass, APICommand apiCmdAnnotation) {
  String apiName = apiCmdAnnotation.name();
  ApiDiscoveryResponse response = new ApiDiscoveryResponse();
  response.setName(apiName);
  response.setDescription(apiCmdAnnotation.description());
  if (!apiCmdAnnotation.since().isEmpty()) {
    response.setSince(apiCmdAnnotation.since());
  }
  Set<Field> fields = ReflectUtil.getAllFieldsForClass(cmdClass, new Class<?>[] {BaseCmd.class, BaseAsyncCmd.class, BaseAsyncCreateCmd.class});
  boolean isAsync = ReflectUtil.isCmdClassAsync(cmdClass, new Class<?>[] {BaseAsyncCmd.class, BaseAsyncCreateCmd.class});
  response.setAsync(isAsync);
  for (Field field : fields) {
    Parameter parameterAnnotation = field.getAnnotation(Parameter.class);
    if (parameterAnnotation != null && parameterAnnotation.expose() && parameterAnnotation.includeInApiDoc()) {
      ApiParameterResponse paramResponse = new ApiParameterResponse();
      paramResponse.setName(parameterAnnotation.name());
      paramResponse.setDescription(parameterAnnotation.description());
      paramResponse.setType(parameterAnnotation.type().toString().toLowerCase());
      paramResponse.setLength(parameterAnnotation.length());
      paramResponse.setRequired(parameterAnnotation.required());
      if (!parameterAnnotation.since().isEmpty()) {
        paramResponse.setSince(parameterAnnotation.since());
      }
      paramResponse.setRelated(parameterAnnotation.entityType()[0].getName());
      response.addParam(paramResponse);
    }
  }
  return response;
}

相关文章