Class PatternIdentifierParser
- java.lang.Object
-
- gov.nist.secauto.oscal.lib.profile.resolver.policy.PatternIdentifierParser
-
- All Implemented Interfaces:
IIdentifierParser
public class PatternIdentifierParser extends Object implements IIdentifierParser
-
-
Field Summary
-
Fields inherited from interface gov.nist.secauto.oscal.lib.profile.resolver.policy.IIdentifierParser
FRAGMENT_PARSER, IDENTITY_PARSER
-
-
Constructor Summary
Constructors Constructor Description PatternIdentifierParser(String pattern, int identifierGroup)PatternIdentifierParser(Pattern pattern, int identifierGroup)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetIdentifierGroup()PatterngetPattern()Stringparse(String referenceText)Parse thereferenceTextfor the identifier.Stringupdate(String referenceText, String newIdentifier)Substitute the providednewIdentifierwith the identifier in thereferenceText.
-
-
-
Constructor Detail
-
PatternIdentifierParser
public PatternIdentifierParser(@NonNull String pattern, int identifierGroup)
-
PatternIdentifierParser
public PatternIdentifierParser(@NonNull Pattern pattern, int identifierGroup)
-
-
Method Detail
-
getPattern
public Pattern getPattern()
-
getIdentifierGroup
public int getIdentifierGroup()
-
parse
public String parse(@NonNull String referenceText)
Description copied from interface:IIdentifierParserParse thereferenceTextfor the identifier.- Specified by:
parsein interfaceIIdentifierParser- Parameters:
referenceText- the reference text containing the identifier- Returns:
- the identifier, or
nullif the identifier could not be parsed
-
update
public String update(@NonNull String referenceText, @NonNull String newIdentifier)
Description copied from interface:IIdentifierParserSubstitute the providednewIdentifierwith the identifier in thereferenceText.- Specified by:
updatein interfaceIIdentifierParser- Parameters:
referenceText- the reference text containing the original identifiernewIdentifier- the new identifier to replace the existing identifier- Returns:
- the updated reference text with the identifier replaced
-
-