001/* 002 * Copyright 2017-2021 original authors 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package io.micronaut.maven.openapi; 017 018/** 019 * A class used to specify parameter mapping. 020 * Parameter mapping would map a given parameter to a specific type and name. 021 */ 022public final class ParameterMapping { 023 /** 024 * The name of the parameter as described by the name field in specification. 025 */ 026 private String name; 027 028 /** 029 * The location of parameter. Path parameters cannot be mapped, as this behavior should not be used. 030 */ 031 private ParameterLocation location; 032 033 /** 034 * The type to which the parameter should be mapped. If multiple parameters have the same mapping, 035 * only one parameter will be present. If set to null, the original parameter will be deleted. 036 */ 037 private String mappedType; 038 039 /** 040 * The unique name of the parameter to be used as method parameter name. 041 */ 042 private String mappedName; 043 044 /** 045 * Whether the mapped parameter requires validation. 046 */ 047 private boolean isValidated; 048 049 public String getName() { 050 return name; 051 } 052 053 public void setName(String name) { 054 this.name = name; 055 } 056 057 public ParameterLocation getLocation() { 058 return location; 059 } 060 061 public void setLocation(ParameterLocation location) { 062 this.location = location; 063 } 064 065 public String getMappedType() { 066 return mappedType; 067 } 068 069 public void setMappedType(String mappedType) { 070 this.mappedType = mappedType; 071 } 072 073 public String getMappedName() { 074 return mappedName; 075 } 076 077 public void setMappedName(String mappedName) { 078 this.mappedName = mappedName; 079 } 080 081 public boolean isValidated() { 082 return isValidated; 083 } 084 085 public void setValidated(boolean validated) { 086 isValidated = validated; 087 } 088 089 /** 090 * The location of the parameter to be mapped. 091 */ 092 public enum ParameterLocation { 093 HEADER, 094 QUERY, 095 FORM, 096 COOKIE, 097 BODY 098 } 099}