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 (the
006 * "License"); you may not use this file except in compliance with the
007 * 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
019
020import java.util.function.*;
021
022/**
023 * Represents an HTTP <c>Vary</c> header.
024 *
025 * <p>
026 * Response fields that determine cache matching.
027 *
028 * @since 9.2.1
029 */
030@SuppressWarnings({
031   "java:S9149" // Public Juneau DSL factory; hiding parent of()/create() is intentional.
032})
033public class Vary extends HttpCsvHeader {
034
035   public static final String NAME = "Vary";
036
037   public Vary(String value) {
038      super(NAME, value);
039   }
040
041   public Vary(String... values) {
042      super(NAME, values);
043   }
044
045   private Vary(Supplier<?> supplier, int lazyMode) {
046      super(NAME, supplier, lazyMode);
047   }
048
049   public static Vary of(String value) {
050      return new Vary(value);
051   }
052
053   public static Vary of(String... values) {
054      return new Vary(values);
055   }
056
057   // Distinct 2-arg factory so two literal String args bind here (returning Vary) instead of the inherited
058   // fixed-arity HttpCsvHeader.of(String name, String value), which Java overload resolution would otherwise prefer.
059   public static Vary of(String value1, String value2) {
060      return new Vary(value1, value2);
061   }
062
063   public static Vary ofLazyWire(Supplier<String> supplier) {
064      return new Vary(supplier, LAZY_WIRE_STRING);
065   }
066
067   public static Vary ofLazyTokens(Supplier<String[]> supplier) {
068      return new Vary(supplier, LAZY_TOKENS);
069   }
070}