Interface CommonDMIMapper<S>
- Type Parameters:
S- the entity type returned by the service implementation
- All Known Implementing Classes:
DMIBaseboardMapper,DMIBIOSLanguageMapper,DMIBIOSMapper,DMICacheMapper,DMIChassisMapper,DMIMemoryDeviceMapper,DMIPhysicalMemoryArrayMapper,DMIPortableBatteryMapper,DMIPortConnectionInformationMapper,DMIProcessorMapper,DMISystemMapper,DMISystemSlotsMapper
public interface CommonDMIMapper<S>
A common mapping interface for converting raw
dmidecode output
into strongly typed Java objects.
Provides default methods to parse structured DMI text data and map it into either:
The mapping process works by:
- Parsing key–value pairs from the raw DMI text
- Normalizing single-line and multi-line values
- Converting the extracted data into JSON internally
- Deserializing the JSON into the requested entity class using Jackson
- Since:
- 0.1.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionmapToEntity(@Nullable String rawDMIData, @NonNull Class<S> mappableEntityClass) Maps rawdmidecodeoutput into a single entity of type<S>.default @NonNull @Unmodifiable List<S> Maps rawdmidecodeoutput into a list of entities of type<S>.
-
Field Details
-
jacksonMapper
static final tools.jackson.databind.ObjectMapper jacksonMapper
-
-
Method Details
-
mapToEntity
@FragileMethod(type=INTERFACE_DEFAULT_METHOD, reason="Parsing formatted human readable dmidecode output is always error-prone and subject to change without notice", requiresReplacement=true, replacementNote="Consider using --json flag of dmidecode if available") default @NonNull Optional<S> mapToEntity(@Nullable String rawDMIData, @NonNull Class<S> mappableEntityClass) Maps rawdmidecodeoutput into a single entity of type<S>.If multiple DMI blocks are present in the input, the last parsed entity is returned.
Multi-line values (for example, lists under keys like
Flags:orCharacteristics:) are automatically aggregated into lists.Example schema:
# dmidecode 3.6 Getting SMBIOS data from sysfs. SMBIOS 3.3.0 present. Handle 0x0011, DMI type 4, 48 bytes Processor Information Socket Designation: FP6 Type: Central Processor Family: Zen Flags: FPU (Floating-point unit on-chip) VME (Virtual mode extension) Version: AMD Ryzen 3 5300U with Radeon Graphics Characteristics: 64-bit capable Multi-Core- Parameters:
rawDMIData- the rawdmidecodeoutputmappableEntityClass- the target entity class- Returns:
- an
Optionalcontaining the mapped entity, or empty if no mappable data is found - Since:
- 0.1.0
-
mapToList
@FragileMethod(type=INTERFACE_DEFAULT_METHOD, reason="Parsing formatted human readable dmidecode output is always error-prone and subject to change without notice", requiresReplacement=true, replacementNote="Consider using --json flag of dmidecode if available") default @NonNull @Unmodifiable List<S> mapToList(@Nullable String rawDMIData, @NonNull Class<S> mappableEntityClass) Maps rawdmidecodeoutput into a list of entities of type<S>.Each DMI block separated by a blank line is treated as an independent entity. Empty or non-mappable blocks are ignored.
This method is useful for DMI structures that naturally occur multiple times, such as cache information, memory devices, or processor entries.
Example schema:
# dmidecode 3.6 Getting SMBIOS data from sysfs. SMBIOS 3.3.0 present. Handle 0x000E, DMI type 7, 27 bytes Cache Information Socket Designation: L1 - Cache Configuration: Enabled, Not Socketed, Level 1 Supported SRAM Types: Pipeline Burst Associativity: 8-way Set-associative Handle 0x000F, DMI type 7, 27 bytes Cache Information Socket Designation: L2 - Cache Configuration: Enabled, Not Socketed, Level 2 Supported SRAM Types: Pipeline Burst Associativity: 8-way Set-associative Handle 0x0010, DMI type 7, 27 bytes Cache Information Socket Designation: L3 - Cache Configuration: Enabled, Not Socketed, Level 3 Supported SRAM Types: Pipeline Burst Associativity: 16-way Set-associative- Parameters:
rawDMIData- the rawdmidecodeoutputmappableEntityClass- the target entity class- Returns:
- a non-null list of mapped entities
- Since:
- 0.1.0
-