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.server;
018
019import static org.apache.juneau.commons.utils.Shorts.*;
020
021import java.lang.annotation.*;
022
023import org.apache.juneau.commons.*;
024
025/**
026 * Utility classes and methods for the {@link RestEndCall @RestEndCall} annotation.
027 *
028 * <h5 class='section'>See Also:</h5><ul>
029 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/LifecycleHooks">Lifecycle Hooks</a>
030 * </ul>
031 */
032public class RestEndCallAnnotation {
033
034   /**
035    * Private constructor to prevent instantiation.
036    */
037   private RestEndCallAnnotation() {
038      // Utility class - prevent instantiation
039   }
040
041   /**
042    * Builder class.
043    *
044    * <h5 class='section'>See Also:</h5><ul>
045    *    <li class='jm'>{@link org.apache.juneau.marshall.MarshallingContext.Builder#annotations(Annotation...)}
046    * </ul>
047    */
048   public static class Builder extends AnnotationObject.Builder {
049
050      private String[] description = {};
051
052      /**
053       * Constructor.
054       */
055      protected Builder() {
056         super(RestEndCall.class);
057      }
058
059      /**
060       * Instantiates a new {@link RestEndCall @RestEndCall} object initialized with this builder.
061       *
062       * @return A new {@link RestEndCall @RestEndCall} object.
063       */
064      public RestEndCall build() {
065         return new Object(this);
066      }
067
068      /**
069       * Sets the description property on this annotation.
070       *
071       * @param value The new value for this property.
072       * @return This object.
073       */
074      public Builder description(String...value) {
075         description = value;
076         return this;
077      }
078
079   }
080
081   @SuppressWarnings({
082      "java:S2160" // equals() inherited from AnnotationObject compares all annotation interface methods; subclass fields are accessed via those methods
083   })
084   private static class Object extends AnnotationObject implements RestEndCall {
085
086      private final String[] description;
087
088      Object(RestEndCallAnnotation.Builder b) {
089         super(b);
090         this.description = cp(b.description);
091      }
092
093      @Override /* Overridden from RestEndCall */
094      public String[] description() {
095         return description;
096      }
097   }
098
099   /** Default value */
100   public static final RestEndCall DEFAULT = create().build();
101
102   /**
103    * Instantiates a new builder for this class.
104    *
105    * @return A new builder object.
106    */
107   public static Builder create() {
108      return new Builder();
109   }
110}