Package gov.nist.secauto.cpe.common
Class WellFormedName
java.lang.Object
gov.nist.secauto.cpe.common.WellFormedName
public class WellFormedName
extends java.lang.Object
The WellFormedName class represents a Well Formed Name, as defined in the CPE Specification
version 2.3.
- Author:
- Joshua Kraunelis, David Waltermire
- See Also:
- NISTIR 7695 Section 5
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WellFormedName.Attribute
-
Constructor Summary
Constructors Constructor Description WellFormedName()
Constructs a new WellFormedName object, with all components set to the default value "ANY".WellFormedName(java.lang.Object part, java.lang.Object vendor, java.lang.Object product, java.lang.Object version, java.lang.Object update, java.lang.Object edition, java.lang.Object language, java.lang.Object swEdition, java.lang.Object targetSoftware, java.lang.Object targetHardware, java.lang.Object other)
Constructs a new WellFormedName object, setting each component to the given parameter value. -
Method Summary
Modifier and Type Method Description java.lang.Object
get(WellFormedName.Attribute attribute)
get the value of the provided attribute.void
set(WellFormedName.Attribute attribute, java.lang.Object value)
Sets the given attribute to value, if the attribute is in the list of permissible components.java.lang.String
toString()
Get the string representation of thisWellFormedName
.
-
Constructor Details
-
WellFormedName
public WellFormedName()Constructs a new WellFormedName object, with all components set to the default value "ANY".- Throws:
java.lang.RuntimeException
- if this implementation is incorrect
-
WellFormedName
public WellFormedName(java.lang.Object part, java.lang.Object vendor, java.lang.Object product, java.lang.Object version, java.lang.Object update, java.lang.Object edition, java.lang.Object language, java.lang.Object swEdition, java.lang.Object targetSoftware, java.lang.Object targetHardware, java.lang.Object other) throws java.text.ParseExceptionConstructs a new WellFormedName object, setting each component to the given parameter value. If a parameter is null, the component is set to the default value "ANY".- Parameters:
part
- string representing the part componentvendor
- string representing the vendor componentproduct
- string representing the product componentversion
- string representing the version componentupdate
- string representing the update componentedition
- string representing the edition componentlanguage
- string representing the language componentswEdition
- string representing the sw_edition componenttargetSoftware
- string representing the target_sw componenttargetHardware
- string representing the target_hw componentother
- string representing the other component- Throws:
java.text.ParseException
- if any of the provided values are invalid
-
-
Method Details
-
get
get the value of the provided attribute.- Parameters:
attribute
- String representing the component value to get- Returns:
- the String value of the given component, or default value
LogicalValue.ANY
if the component does not exist
-
set
public final void set(WellFormedName.Attribute attribute, java.lang.Object value) throws java.text.ParseExceptionSets the given attribute to value, if the attribute is in the list of permissible components.- Parameters:
attribute
- enumerated value representing the component to setvalue
- Object representing the value of the given component- Throws:
java.text.ParseException
- if the provided value is invalid
-
toString
public java.lang.String toString()Get the string representation of thisWellFormedName
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string representation of the WellFormedName
-