CloudStack中@APICommand、@Parameter注解字段解释

简介: CloudStack中@APICommand、@Parameter注解字段解释

一、@APICommand

// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api;
 
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
 
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.ResponseObject.ResponseView;
 
import static java.lang.annotation.ElementType.TYPE;
 
@Retention(RetentionPolicy.RUNTIME)
@Target({TYPE})
public @interface APICommand {
    //命令的响应类(class<? Extends BaseResponse)
    Class<? extends BaseResponse> responseObject();
 
    //名称(字符串并且全局唯一)
    String name() default "";
 
    //描述(字符串,默认空)
    String description() default "";
 
    //使用方法(字符串,默认空)
    String usage() default "";
 
    //    声明是否包含在 API 文档中(boolean,默认 true)
    boolean includeInApiDoc() default true;
 
    //  命令在哪个版本加入的(字符串,默认空)
    String since() default "";
 
    ResponseView responseView() default ResponseView.Full;
 
    boolean requestHasSensitiveInfo() default true;
 
    boolean responseHasSensitiveInfo() default true;
 
    RoleType[] authorized() default {};
 
    Class<?>[] entityType() default {};
}

二、@Parameter

// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api;
 
import static java.lang.annotation.ElementType.FIELD;
 
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
 
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.BaseCmd.CommandType;
 
@Retention(RetentionPolicy.RUNTIME)
@Target({FIELD})
public @interface Parameter {
    //    参数名称(字符串,默认空)
    String name() default "";
 
    //描述(字符串,默认空)
    String description() default "";
 
    //必填(boolean,默认 false)
    boolean required() default false;
 
    //参数类型(CommandType 枚举)
    CommandType type() default CommandType.OBJECT;
 
    //如果参数类型为 list,需要指定集合泛型(CommandType 枚举
    CommandType collectionType() default CommandType.OBJECT;
 
    //映射数据库实体类型
    Class<?>[] entityType() default Object.class;
 
    //如果设置 false,将忽略传递的参数(boolean,默认 true)
    boolean expose() default true;
 
    //声明是否包含在 API 文档中(boolean,默认 true)
    boolean includeInApiDoc() default true;
 
    //参数的最大长度(整形,默认 255)
    int length() default 255;
 
    //参数的最大长度(整形,默认 255)
    String since() default "";
 
    RoleType[] authorized() default {};
 
    ApiArgValidator[] validations() default {};
 
    boolean acceptedOnAdminPort() default true;
}
相关文章
|
Java 编译器 API
【小家Java】Lombok的使用详解(最详尽的解释,覆盖讲解所有可用注解),解决@Builder.Default默认值问题(下)
【小家Java】Lombok的使用详解(最详尽的解释,覆盖讲解所有可用注解),解决@Builder.Default默认值问题(下)
【小家Java】Lombok的使用详解(最详尽的解释,覆盖讲解所有可用注解),解决@Builder.Default默认值问题(下)
|
3月前
|
XML 缓存 API
【Azure API 管理】使用APIM进行XML内容读取时遇见的诡异错误 Expression evaluation failed. Object reference not set to an instance of an object.
【Azure API 管理】使用APIM进行XML内容读取时遇见的诡异错误 Expression evaluation failed. Object reference not set to an instance of an object.
|
4月前
|
SQL
自定义SQL,可以利用MyBatisPlus的Wrapper来构建复杂的Where条件,如何自定义SQL呢?利用MyBatisPlus的Wrapper来构建Wh,在mapper方法参数中用Param注
自定义SQL,可以利用MyBatisPlus的Wrapper来构建复杂的Where条件,如何自定义SQL呢?利用MyBatisPlus的Wrapper来构建Wh,在mapper方法参数中用Param注
|
4月前
|
Java
映射大量文件的正解,Description:Field commentMapper in zero.file.videoProject.controller.CommentController r
映射大量文件的正解,Description:Field commentMapper in zero.file.videoProject.controller.CommentController r
|
6月前
|
编译器 C#
C#.Net筑基-类型系统②常见类型 --record是什么类型?
`record`在C#中是一种创建简单、只读数据结构的方式,常用于轻量级数据传输。它本质上是类(默认)或结构体的快捷形式,包含自动生成的属性、`Equals`、`ToString`、解构赋值等方法。记录类型可以继承其他record或接口,但不继承普通类。支持使用`with`语句创建副本。例如,`public record User(string Name, int Age)`会被编译为包含属性、相等比较和`ToString()`等方法的类。记录类型提供了解构赋值和自定义实现,如密封的`sealed`记录,防止子类重写。
|
6月前
|
SQL JSON Java
【bug日记】已解决:Invalid bound statement (not found): 找不到对应的Mapper映射类
【bug日记】已解决:Invalid bound statement (not found): 找不到对应的Mapper映射类
|
11月前
注解支持@Alias同步值
注解支持@Alias同步值
90 0
|
开发者 C++
【C++11保姆级教程】Type aliases(类型别名)、alignof and alignas(类型对齐))
【C++11保姆级教程】Type aliases(类型别名)、alignof and alignas(类型对齐))
|
XML SQL Java
如何去寻找解决bug?(以Mapped Statements collection does not contain value for xxx的异常为例)
如何去寻找解决bug?(以Mapped Statements collection does not contain value for xxx的异常为例)
如何去寻找解决bug?(以Mapped Statements collection does not contain value for xxx的异常为例)
|
Java 数据库
JPA通用策略生成器(@GeneratedValue 四种标准用法为TABLE, SEQUENCE, IDENTITY, AUTO)
JPA通用策略生成器(@GeneratedValue 四种标准用法为TABLE, SEQUENCE, IDENTITY, AUTO)
200 0