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;
}
相关文章
|
8月前
|
SQL JSON Java
【bug日记】已解决:Invalid bound statement (not found): 找不到对应的Mapper映射类
【bug日记】已解决:Invalid bound statement (not found): 找不到对应的Mapper映射类
|
人工智能 Java
getParameter方法的用法
getParameter方法的用法
|
存储 Perl
Verilog读书笔记---数据类型、系统任务、`define、parameter、localparam三者的区别
Verilog读书笔记---数据类型、系统任务、`define、parameter、localparam三者的区别
763 0
Verilog读书笔记---数据类型、系统任务、`define、parameter、localparam三者的区别
|
Java 容器 Spring
请举例解释@Required注解?
请举例解释@Required注解?
请举例解释@Required注解?