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