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.http.header;
018
019import java.util.function.*;
020
021import org.apache.juneau.http.annotation.*;
022
023/**
024 * Represents a parsed <l>No-Trace</l> HTTP request header.
025 *
026 * <h5 class='section'>See Also:</h5><ul>
027 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauRestCommonBasics">juneau-rest-common Basics</a>
028 * </ul>
029 *
030 * @serial exclude
031 */
032@Header("No-Trace")
033public class NoTrace extends BasicBooleanHeader {
034   private static final long serialVersionUID = 1L;
035   private static final String NAME = "No-Trace";
036
037   @SuppressWarnings("javadoc")
038   public static final NoTrace TRUE = of(true), FALSE = of(false);
039
040   /**
041    * Static creator.
042    *
043    * @param value
044    *    The header value.
045    *    <br>Can be <jk>null</jk>.
046    * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>.
047    */
048   public static NoTrace of(Boolean value) {
049      return value == null ? null : new NoTrace(value);
050   }
051
052   /**
053    * Static creator.
054    *
055    * @param value
056    *    The header value.
057    *    <br>Must be parsable by {@link Boolean#parseBoolean(String)}.
058    *    <br>Can be <jk>null</jk>.
059    * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>.
060    */
061   public static NoTrace of(String value) {
062      return value == null ? null : new NoTrace(value);
063   }
064
065   /**
066    * Static creator with delayed value.
067    *
068    * <p>
069    * Header value is re-evaluated on each call to {@link #getValue()}.
070    *
071    * @param value
072    *    The header value supplier.
073    *    <br>Can be <jk>null</jk>.
074    * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>.
075    */
076   public static NoTrace of(Supplier<Boolean> value) {
077      return value == null ? null : new NoTrace(value);
078   }
079
080   /**
081    * Constructor.
082    *
083    * @param value
084    *    The header value.
085    *    <br>Can be <jk>null</jk>.
086    */
087   public NoTrace(Boolean value) {
088      super(NAME, value);
089   }
090
091   /**
092    * Constructor.
093    *
094    * @param value
095    *    The header value.
096    *    <br>Must be parsable by {@link Boolean#parseBoolean(String)}.
097    *    <br>Can be <jk>null</jk>.
098    */
099   public NoTrace(String value) {
100      super(NAME, value);
101   }
102
103   /**
104    * Constructor with delayed value.
105    *
106    * <p>
107    * Header value is re-evaluated on each call to {@link #getValue()}.
108    *
109    * @param value
110    *    The supplier of the header value.
111    *    <br>Can be <jk>null</jk>.
112    */
113   public NoTrace(Supplier<Boolean> value) {
114      super(NAME, value);
115   }
116}