LCOV - code coverage report
Current view: top level - server/plugins - PluginEntry.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 0 17 0.0 %
Date: 2022-11-19 15:00:39 Functions: 0 8 0.0 %

          Line data    Source code
       1             : // Copyright (C) 2014 The Android Open Source Project
       2             : //
       3             : // Licensed under the Apache License, Version 2.0 (the "License");
       4             : // you may not use this file except in compliance with the License.
       5             : // You may obtain a copy of the License at
       6             : //
       7             : // http://www.apache.org/licenses/LICENSE-2.0
       8             : //
       9             : // Unless required by applicable law or agreed to in writing, software
      10             : // distributed under the License is distributed on an "AS IS" BASIS,
      11             : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             : // See the License for the specific language governing permissions and
      13             : // limitations under the License.
      14             : 
      15             : package com.google.gerrit.server.plugins;
      16             : 
      17             : import static java.util.Comparator.comparing;
      18             : 
      19             : import java.util.Collections;
      20             : import java.util.Comparator;
      21             : import java.util.Map;
      22             : import java.util.Optional;
      23             : 
      24             : /**
      25             :  * Plugin static resource entry
      26             :  *
      27             :  * <p>Bean representing a static resource inside a plugin. All static resources are available at
      28             :  * {@code <plugin web url>/static} and served by the HttpPluginServlet.
      29             :  */
      30             : public class PluginEntry {
      31             :   public static final String ATTR_CHARACTER_ENCODING = "Character-Encoding";
      32             :   public static final String ATTR_CONTENT_TYPE = "Content-Type";
      33           0 :   public static final Comparator<PluginEntry> COMPARATOR_BY_NAME = comparing(PluginEntry::getName);
      34             : 
      35           0 :   private static final Map<Object, String> EMPTY_ATTRS = Collections.emptyMap();
      36           0 :   private static final Optional<Long> NO_SIZE = Optional.empty();
      37             : 
      38             :   private final String name;
      39             :   private final long time;
      40             :   private final Optional<Long> size;
      41             :   private final Map<Object, String> attrs;
      42             : 
      43           0 :   public PluginEntry(String name, long time, Optional<Long> size, Map<Object, String> attrs) {
      44           0 :     this.name = name;
      45           0 :     this.time = time;
      46           0 :     this.size = size;
      47           0 :     this.attrs = attrs;
      48           0 :   }
      49             : 
      50             :   public PluginEntry(String name, long time, Optional<Long> size) {
      51           0 :     this(name, time, size, EMPTY_ATTRS);
      52           0 :   }
      53             : 
      54             :   public PluginEntry(String name, long time) {
      55           0 :     this(name, time, NO_SIZE, EMPTY_ATTRS);
      56           0 :   }
      57             : 
      58             :   public String getName() {
      59           0 :     return name;
      60             :   }
      61             : 
      62             :   public long getTime() {
      63           0 :     return time;
      64             :   }
      65             : 
      66             :   public Optional<Long> getSize() {
      67           0 :     return size;
      68             :   }
      69             : 
      70             :   public Map<Object, String> getAttrs() {
      71           0 :     return attrs;
      72             :   }
      73             : }

Generated by: LCOV version 1.16+git.20220603.dfeb750