001/* 002 * ============================================================================ 003 * Copyright © 2015 Square, Inc. 004 * Copyright for the modifications © 2018-2024 by Thomas Thrien. 005 * ============================================================================ 006 * 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 */ 019 020package org.tquadrat.foundation.javacomposer; 021 022import static org.apiguardian.api.API.Status.STABLE; 023 024import javax.lang.model.element.Modifier; 025 026import org.apiguardian.api.API; 027import org.tquadrat.foundation.annotation.ClassVersion; 028 029/** 030 * The specification for a generated parameter declaration. 031 * 032 * @author Square,Inc. 033 * @modified Thomas Thrien - thomas.thrien@tquadrat.org 034 * @version $Id: ParameterSpec.java 1085 2024-01-05 16:23:28Z tquadrat $ 035 * @since 0.0.5 036 * 037 * @UMLGraph.link 038 */ 039@ClassVersion( sourceVersion = "$Id: ParameterSpec.java 1085 2024-01-05 16:23:28Z tquadrat $" ) 040@API( status = STABLE, since = "0.0.5" ) 041public interface ParameterSpec 042{ 043 /*---------------*\ 044 ====** Inner Classes **==================================================== 045 \*---------------*/ 046 /** 047 * The builder for an instance of 048 * {@link ParameterSpec} 049 * 050 * @author Square,Inc. 051 * @modified Thomas Thrien - thomas.thrien@tquadrat.org 052 * @version $Id: ParameterSpec.java 1085 2024-01-05 16:23:28Z tquadrat $ 053 * @since 0.0.5 054 * 055 * @UMLGraph.link 056 */ 057 @SuppressWarnings( "InnerClassOfInterface" ) 058 @ClassVersion( sourceVersion = "$Id: ParameterSpec.java 1085 2024-01-05 16:23:28Z tquadrat $" ) 059 @API( status = STABLE, since = "0.0.5" ) 060 public static interface Builder 061 { 062 /*---------*\ 063 ====** Methods **====================================================== 064 \*---------*/ 065 /** 066 * Adds an annotation for the parameter. 067 * 068 * @param annotationSpec The annotation. 069 * @return This {@code Builder} instance. 070 */ 071 public Builder addAnnotation( final AnnotationSpec annotationSpec ); 072 073 /** 074 * Adds an annotation for the parameter. 075 * 076 * @param annotation The annotation. 077 * @return This {@code Builder} instance. 078 */ 079 public Builder addAnnotation( final Class<?> annotation ); 080 081 /** 082 * Adds an annotation for the parameter. 083 * 084 * @param annotationClassName The name of the annotation class. 085 * @return This {@code Builder} instance. 086 */ 087 public Builder addAnnotation( final ClassName annotationClassName ); 088 089 /** 090 * Adds annotations for the parameter. 091 * 092 * @param annotationSpecs The annotation. 093 * @return This {@code Builder} instance. 094 */ 095 public Builder addAnnotations( final Iterable<AnnotationSpec> annotationSpecs ); 096 097 /** 098 * Adds text to the JavaDoc for the parameter. 099 * 100 * @param block The comment text. 101 * @return This {@code Builder} instance. 102 */ 103 public Builder addJavadoc( final CodeBlock block ); 104 105 /** 106 * Adds text to the Javadoc for the parameter. 107 * 108 * @param format The format. 109 * @param args The arguments. 110 * @return This {@code Builder} instance. 111 */ 112 public Builder addJavadoc( final String format, final Object... args ); 113 114 /** 115 * Adds modifiers for the parameter. 116 * 117 * @param modifiers The modifiers. 118 * @return This {@code Builder} instance. 119 */ 120 public Builder addModifiers( final Iterable<Modifier> modifiers ); 121 122 /** 123 * Adds modifiers for the parameter. 124 * 125 * @param modifiers The modifiers. 126 * @return This {@code Builder} instance. 127 */ 128 public Builder addModifiers( final Modifier... modifiers ); 129 130 /** 131 * Builds a new 132 * {@link ParameterSpec} 133 * instance from the added components. 134 * 135 * @return The new {@code ParameterSpec} instance. 136 */ 137 public ParameterSpec build(); 138 } 139 // interface Builder 140 141 /*---------*\ 142 ====** Methods **========================================================== 143 \*---------*/ 144 /** 145 * {@inheritDoc} 146 */ 147 @Override 148 public boolean equals( final Object o ); 149 150 /** 151 * {@inheritDoc} 152 */ 153 @Override 154 public int hashCode(); 155 156 /** 157 * Checks whether this parameter has the given modifier. 158 * 159 * @param modifier The modifier. 160 * @return {@code true} if the parameter has the given modifier, 161 * {@code false} if not. 162 */ 163 public boolean hasModifier( final Modifier modifier ); 164 165 /** 166 * Returns the name of this parameter. 167 * 168 * @return The name. 169 */ 170 public String name(); 171 172 /** 173 * Returns a builder that is initialised with the components of this 174 * parameter. 175 * 176 * @return The builder. 177 */ 178 public Builder toBuilder(); 179 180 /** 181 * Returns a builder for a parameter with the given type and name, and 182 * that is initialised with the components of this parameter. 183 * 184 * @param type The type for the new parameter. 185 * @param name The name for the new parameter. 186 * @param keepJavadoc {@code true} if an existing Javadoc comment should 187 * be preserved, {@code false} if it should be dropped. 188 * @return The builder. 189 */ 190 public Builder toBuilder( final TypeName type, final CharSequence name, final boolean keepJavadoc ); 191 192 /** 193 * {@inheritDoc} 194 */ 195 @Override 196 public String toString(); 197 198 /** 199 * Returns the type of this parameter. 200 * 201 * @return The type 202 */ 203 public TypeName type(); 204} 205// interface ParameterSpec 206 207/* 208 * End of File 209 */