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 int
getIdentifierGroup()
Pattern
getPattern()
String
parse(String referenceText)
Parse thereferenceText
for the identifier.String
update(String referenceText, String newIdentifier)
Substitute the providednewIdentifier
with 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:IIdentifierParser
Parse thereferenceText
for the identifier.- Specified by:
parse
in interfaceIIdentifierParser
- Parameters:
referenceText
- the reference text containing the identifier- Returns:
- the identifier, or
null
if the identifier could not be parsed
-
update
public String update(@NonNull String referenceText, @NonNull String newIdentifier)
Description copied from interface:IIdentifierParser
Substitute the providednewIdentifier
with the identifier in thereferenceText
.- Specified by:
update
in 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
-
-