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.classic.header; 018 019import java.util.function.*; 020 021import org.apache.juneau.http.*; 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/JuneauRestCommon">juneau-rest-common</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 /** Constant for <jk>true</jk> value. */ 038 public static final NoTrace TRUE = of(true); 039 /** Constant for <jk>false</jk> value. */ 040 public static final NoTrace FALSE = of(false); 041 042 /** 043 * Static creator. 044 * 045 * @param value 046 * The header value. 047 * <br>Can be <jk>null</jk>. 048 * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>. 049 */ 050 public static NoTrace of(Boolean value) { 051 return value == null ? null : new NoTrace(value); 052 } 053 054 /** 055 * Static creator. 056 * 057 * @param value 058 * The header value. 059 * <br>Must be parsable by {@link Boolean#parseBoolean(String)}. 060 * <br>Can be <jk>null</jk>. 061 * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>. 062 */ 063 public static NoTrace of(String value) { 064 return value == null ? null : new NoTrace(value); 065 } 066 067 /** 068 * Static creator with delayed value. 069 * 070 * <p> 071 * Header value is re-evaluated on each call to {@link #getValue()}. 072 * 073 * @param value 074 * The header value supplier. 075 * <br>Can be <jk>null</jk>. 076 * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>. 077 */ 078 public static NoTrace of(Supplier<Boolean> value) { 079 return value == null ? null : new NoTrace(value); 080 } 081 082 /** 083 * Constructor. 084 * 085 * @param value 086 * The header value. 087 * <br>Can be <jk>null</jk> to create a header with no value. 088 */ 089 public NoTrace(Boolean value) { 090 super(NAME, value); 091 } 092 093 /** 094 * Constructor. 095 * 096 * @param value 097 * The header value. 098 * <br>Must be parsable by {@link Boolean#parseBoolean(String)}. 099 * <br>Can be <jk>null</jk> to create a header with no value. 100 */ 101 public NoTrace(String value) { 102 super(NAME, value); 103 } 104 105 /** 106 * Constructor with delayed value. 107 * 108 * <p> 109 * Header value is re-evaluated on each call to {@link #getValue()}. 110 * 111 * @param value 112 * The supplier of the header value. 113 * <br>Can be <jk>null</jk> to create a header with no value. 114 */ 115 public NoTrace(Supplier<Boolean> value) { 116 super(NAME, value); 117 } 118}