View Javadoc
1   /*
2    * Copyright 2016-2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.hardware.common;
6   
7   import oshi.annotation.concurrent.Immutable;
8   import oshi.hardware.Firmware;
9   import oshi.util.Constants;
10  
11  /**
12   * Firmware data.
13   */
14  @Immutable
15  public abstract class AbstractFirmware implements Firmware {
16  
17      /*
18       * Multiple classes don't have these, set defaults here
19       */
20  
21      @Override
22      public String getName() {
23          return Constants.UNKNOWN;
24      }
25  
26      @Override
27      public String getDescription() {
28          return Constants.UNKNOWN;
29      }
30  
31      @Override
32      public String getReleaseDate() {
33          return Constants.UNKNOWN;
34      }
35  
36      @Override
37      public String toString() {
38          StringBuilder sb = new StringBuilder();
39          sb.append("manufacturer=").append(getManufacturer()).append(", ");
40          sb.append("name=").append(getName()).append(", ");
41          sb.append("description=").append(getDescription()).append(", ");
42          sb.append("version=").append(getVersion()).append(", ");
43          sb.append("release date=").append(getReleaseDate() == null ? "unknown" : getReleaseDate());
44          return sb.toString();
45      }
46  
47  }