All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.wordnik.swagger.annotations.ApiModelProperty Maven / Gradle / Ivy

The newest version!
/**
 *  Copyright 2013 Wordnik, Inc.
 *
 *  Licensed 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 com.wordnik.swagger.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/** 
 * An ApiModelProperty desecribes a property inside a model class.  The annotations can
 * apply to a method, a property, etc., depending on how the model scanner is configured and
 * used.
 */
@Target({ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ApiModelProperty {
  /** Provide a human readable synopsis of this property */
  String value() default "";

  /**
   * If the values that can be set are restricted, they can be set here. In the form of a comma separated list
   * registered, active, closed.
   *
   * @return the allowable values
   */
  String allowableValues() default "";

  /** 
   * specify an optional access value for filtering in a Filter 
   * implementation.  This
   * allows you to hide certain parameters if a user doesn't have access to them
   */
  String access() default "";

  /** long description of the property */
  String notes() default "";

  /**
   * The dataType. See the documentation for the supported datatypes. If the data type is a custom object, set
   * it's name, or nothing. In case of an enum use 'string' and allowableValues for the enum constants.
   */
  String dataType() default "";

  /**
   * Whether or not the property is required, defaults to false.
   * 
   * @return true if required, false otherwise
   */
  boolean required() default false;

  /**
   * allows explicitly ordering the property in the model.  Since reflection has no guarantee on
   * ordering, you should specify property order to keep models consistent across different VM implementations and versions.
   */
  int position() default 0;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy