001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.rest.annotation;
018
019import static java.lang.annotation.ElementType.*;
020import static java.lang.annotation.RetentionPolicy.*;
021import static org.apache.juneau.commons.utils.CollectionUtils.*;
022
023import java.lang.annotation.*;
024
025import org.apache.juneau.commons.annotation.*;
026
027/**
028 * Utility classes and methods for the {@link RestStartCall @RestStartCall} annotation.
029 *
030 * <h5 class='section'>See Also:</h5><ul>
031 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/LifecycleHooks">Lifecycle Hooks</a>
032 * </ul>
033 */
034public class RestStartCallAnnotation {
035   /**
036    * A collection of {@link RestStartCall @RestStartCall annotations}.
037    */
038   @Documented
039   @Target({ METHOD, TYPE })
040   @Retention(RUNTIME)
041   @Inherited
042   public static @interface Array {
043
044      /**
045       * The child annotations.
046       *
047       * @return The annotation value.
048       */
049      RestStartCall[] value();
050   }
051
052   /**
053    * Builder class.
054    *
055    * <h5 class='section'>See Also:</h5><ul>
056    *    <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#annotations(Annotation...)}
057    * </ul>
058    */
059   public static class Builder extends AppliedAnnotationObject.BuilderM {
060
061      private String[] description = {};
062
063      /**
064       * Constructor.
065       */
066      protected Builder() {
067         super(RestStartCall.class);
068      }
069
070      /**
071       * Instantiates a new {@link RestStartCall @RestStartCall} object initialized with this builder.
072       *
073       * @return A new {@link RestStartCall @RestStartCall} object.
074       */
075      public RestStartCall build() {
076         return new Object(this);
077      }
078
079      /**
080       * Sets the description property on this annotation.
081       *
082       * @param value The new value for this property.
083       * @return This object.
084       */
085      public Builder description(String...value) {
086         description = value;
087         return this;
088      }
089
090      @Override /* Overridden from AppliedAnnotationObject.Builder */
091      public Builder on(String...value) {
092         super.on(value);
093         return this;
094      }
095      @Override /* Overridden from AppliedAnnotationObject.BuilderM */
096      public Builder on(java.lang.reflect.Method...value) {
097         super.on(value);
098         return this;
099      }
100
101   
102      @Override /* Overridden from AppliedAnnotationObject.BuilderM */
103      public Builder on(org.apache.juneau.commons.reflect.MethodInfo...value) {
104         super.on(value);
105         return this;
106      }
107
108   }
109
110   private static class Object extends AppliedAnnotationObject implements RestStartCall {
111
112      private final String[] description;
113
114      Object(RestStartCallAnnotation.Builder b) {
115         super(b);
116         this.description = copyOf(b.description);
117      }
118
119      @Override /* Overridden from RestStartCall */
120      public String[] description() {
121         return description;
122      }
123   }
124
125   /** Default value */
126   public static final RestStartCall DEFAULT = create().build();
127
128   /**
129    * Instantiates a new builder for this class.
130    *
131    * @return A new builder object.
132    */
133   public static Builder create() {
134      return new Builder();
135   }
136}