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 035 //----------------------------------------------------------------------------------------------------------------- 036 // Static 037 //----------------------------------------------------------------------------------------------------------------- 038 039 private static final long serialVersionUID = 1L; 040 private static final String NAME = "No-Trace"; 041 042 @SuppressWarnings("javadoc") 043 public static final NoTrace TRUE = of(true), FALSE = of(false); 044 045 /** 046 * Static creator. 047 * 048 * @param value 049 * The header value. 050 * <br>Must be parsable by {@link Boolean#parseBoolean(String)}. 051 * <br>Can be <jk>null</jk>. 052 * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>. 053 */ 054 public static NoTrace of(String value) { 055 return value == null ? null : new NoTrace(value); 056 } 057 058 /** 059 * Static creator. 060 * 061 * @param value 062 * The header value. 063 * <br>Can be <jk>null</jk>. 064 * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>. 065 */ 066 public static NoTrace of(Boolean value) { 067 return value == null ? null : new NoTrace(value); 068 } 069 070 /** 071 * Static creator with delayed value. 072 * 073 * <p> 074 * Header value is re-evaluated on each call to {@link #getValue()}. 075 * 076 * @param value 077 * The header value supplier. 078 * <br>Can be <jk>null</jk>. 079 * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>. 080 */ 081 public static NoTrace of(Supplier<Boolean> value) { 082 return value == null ? null : new NoTrace(value); 083 } 084 085 //----------------------------------------------------------------------------------------------------------------- 086 // Instance 087 //----------------------------------------------------------------------------------------------------------------- 088 089 /** 090 * Constructor. 091 * 092 * @param value 093 * The header value. 094 * <br>Must be parsable by {@link Boolean#parseBoolean(String)}. 095 * <br>Can be <jk>null</jk>. 096 */ 097 public NoTrace(String value) { 098 super(NAME, value); 099 } 100 101 /** 102 * Constructor. 103 * 104 * @param value 105 * The header value. 106 * <br>Can be <jk>null</jk>. 107 */ 108 public NoTrace(Boolean value) { 109 super(NAME, value); 110 } 111 112 /** 113 * Constructor with delayed value. 114 * 115 * <p> 116 * Header value is re-evaluated on each call to {@link #getValue()}. 117 * 118 * @param value 119 * The supplier of the header value. 120 * <br>Can be <jk>null</jk>. 121 */ 122 public NoTrace(Supplier<Boolean> value) { 123 super(NAME, value); 124 } 125}