Package org.spdx.licenseTemplate
Class LicenseTemplateRule
java.lang.Object
org.spdx.licenseTemplate.LicenseTemplateRule
public class LicenseTemplateRule extends Object
Implements a license rule
- Author:
- Gary O'Neall
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLicenseTemplateRule.RuleType -
Constructor Summary
Constructors Constructor Description LicenseTemplateRule(String parseableLicenseTemplateRule)Create a new License Template Rule by parsing a rule string compliant with the SPDX License Template textLicenseTemplateRule(String ruleName, LicenseTemplateRule.RuleType ruleType)LicenseTemplateRule(String name, LicenseTemplateRule.RuleType type, String original, String match, String example)Create a new LicenseTemplateRule -
Method Summary
Modifier and Type Method Description StringgetExample()StringgetMatch()StringgetName()StringgetOriginal()LicenseTemplateRule.RuleTypegetType()voidparseLicenseTemplateRule(String parseableLicenseTemplateRule)Parse a license template rule string compliant with the SPDX license template text and replace all properties with the parsed valuesvoidsetExample(String example)voidsetMatch(String match)voidsetName(String name)voidsetOriginal(String original)voidsetType(LicenseTemplateRule.RuleType type)StringtoString()voidvalidate()Validates that the LicenseTemplateRule is properly initialized
-
Constructor Details
-
LicenseTemplateRule
public LicenseTemplateRule(String name, LicenseTemplateRule.RuleType type, String original, String match, String example) throws LicenseTemplateRuleExceptionCreate a new LicenseTemplateRule- Parameters:
name- Name of the rule - must not be nulltype- - type of ruleoriginal- - Original text - must not be nullexample- - Example text - may be null- Throws:
LicenseTemplateRuleException
-
LicenseTemplateRule
public LicenseTemplateRule(String parseableLicenseTemplateRule) throws LicenseTemplateRuleExceptionCreate a new License Template Rule by parsing a rule string compliant with the SPDX License Template text- Parameters:
parseableLicenseTemplateRule-- Throws:
LicenseTemplateRuleException
-
LicenseTemplateRule
public LicenseTemplateRule(String ruleName, LicenseTemplateRule.RuleType ruleType) throws LicenseTemplateRuleException- Parameters:
ruleName-ruleType-- Throws:
LicenseTemplateRuleException
-
-
Method Details
-
toString
-
validate
Validates that the LicenseTemplateRule is properly initialized- Throws:
LicenseTemplateRuleException
-
parseLicenseTemplateRule
public void parseLicenseTemplateRule(String parseableLicenseTemplateRule) throws LicenseTemplateRuleExceptionParse a license template rule string compliant with the SPDX license template text and replace all properties with the parsed values- Parameters:
parseableLicenseTemplateRule-- Throws:
LicenseTemplateRuleException
-
getType
-
setType
- Parameters:
type- the type to set
-
getOriginal
- Returns:
- the original
-
setOriginal
- Parameters:
original- the original to set
-
getName
- Returns:
- the name
-
setName
- Parameters:
name- the name to set
-
getExample
- Returns:
- the example
-
setExample
- Parameters:
example- the example to set
-
getMatch
- Returns:
- the match
-
setMatch
- Parameters:
match- the match to set
-