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.annotation;
014
015import static java.lang.annotation.ElementType.*;
016import static java.lang.annotation.RetentionPolicy.*;
017
018import java.lang.annotation.*;
019
020/**
021 * Identifies a class as a builder for a POJO class.
022 *
023 * <h5 class='figure'>Example:</h5>
024 * <p class='bjava'>
025 *    <jc>// POJO class.</jc>
026 *    <ja>@Builder</ja>(MyBeanBuilder.<jk>class</jk>)
027 *    <jk>public class</jk> MyBean {
028 *
029 *       <jc>// Read-only properties.</jc>
030 *       <jk>public final</jk> String <jf>foo</jf>;
031 *       <jk>public final int</jk> <jf>bar</jf>;
032 *
033 *       <jc>// Constructor that takes in a builder.</jc>
034 *       <jk>public</jk> MyBean(MyBeanBuilder <jv>builder</jv>) {
035 *          <jk>this</jk>.<jf>foo</jf> = <jv>builder</jv>.<jf>foo</jf>;
036 *          <jk>this</jk>.<jf>bar</jf> = <jv>builder</jv>.<jf>bar</jf>;
037 *       }
038 *    }
039 *
040 *    <jc>// Builder class.</jc>
041 *    <jk>public class</jk> MyBeanBuilder {
042 *       <jk>public</jk> String <jf>foo</jf>;
043 *       <jk>public int</jk> <jf>bar</jf>;
044 *
045 *       <jc>// Method that creates the bean.</jc>
046 *       <jk>public</jk> MyBean build() {
047 *          <jk>return new</jk> MyBean(<jk>this</jk>);
048 *       }
049 *
050 *       <jc>// Bean property setters.</jc>
051 *    }
052 * </p>
053 *
054 * <h5 class='section'>See Also:</h5><ul>
055 *    <li class='link'><a class="doclink" href="../../../../index.html#jm.PojoBuilders">POJO Builders</a>
056
057 * </ul>
058 */
059@Documented
060@Target({TYPE})
061@Retention(RUNTIME)
062@Inherited
063public @interface Builder {
064
065   /**
066    * The builder for this class.
067    *
068    * @return The annotation value.
069    */
070   Class<?> value() default void.class;
071}