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.*; 021 022import java.lang.annotation.*; 023 024import org.apache.juneau.annotation.*; 025 026/** 027 * Utility classes and methods for the {@link RestPreCall @RestPreCall} annotation. 028 * 029 * <h5 class='section'>See Also:</h5><ul> 030 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/LifecycleHooks">Lifecycle Hooks</a> 031 * </ul> 032 */ 033public class RestPreCallAnnotation { 034 035 //----------------------------------------------------------------------------------------------------------------- 036 // Static 037 //----------------------------------------------------------------------------------------------------------------- 038 039 /** Default value */ 040 public static final RestPreCall DEFAULT = create().build(); 041 042 /** 043 * Instantiates a new builder for this class. 044 * 045 * @return A new builder object. 046 */ 047 public static Builder create() { 048 return new Builder(); 049 } 050 051 //----------------------------------------------------------------------------------------------------------------- 052 // Builder 053 //----------------------------------------------------------------------------------------------------------------- 054 055 /** 056 * Builder class. 057 * 058 * <h5 class='section'>See Also:</h5><ul> 059 * <li class='jm'>{@link org.apache.juneau.BeanContext.Builder#annotations(Annotation...)} 060 * </ul> 061 */ 062 public static class Builder extends TargetedAnnotationMBuilder<Builder> { 063 064 /** 065 * Constructor. 066 */ 067 protected Builder() { 068 super(RestPreCall.class); 069 } 070 071 /** 072 * Instantiates a new {@link RestPreCall @RestPreCall} object initialized with this builder. 073 * 074 * @return A new {@link RestPreCall @RestPreCall} object. 075 */ 076 public RestPreCall build() { 077 return new Impl(this); 078 } 079 080 } 081 082 //----------------------------------------------------------------------------------------------------------------- 083 // Implementation 084 //----------------------------------------------------------------------------------------------------------------- 085 086 private static class Impl extends TargetedAnnotationImpl implements RestPreCall { 087 088 Impl(Builder b) { 089 super(b); 090 postConstruct(); 091 } 092 } 093 094 //----------------------------------------------------------------------------------------------------------------- 095 // Other 096 //----------------------------------------------------------------------------------------------------------------- 097 098 /** 099 * A collection of {@link RestPreCall @RestPreCall annotations}. 100 */ 101 @Documented 102 @Target({METHOD,TYPE}) 103 @Retention(RUNTIME) 104 @Inherited 105 public static @interface Array { 106 107 /** 108 * The child annotations. 109 * 110 * @return The annotation value. 111 */ 112 RestPreCall[] value(); 113 } 114}