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
All Methods Instance Methods Concrete Methods 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 Detail
-
LicenseTemplateRule
public LicenseTemplateRule(String name, LicenseTemplateRule.RuleType type, String original, String match, String example) throws LicenseTemplateRuleException
Create 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- if the license template could not be parsed
-
LicenseTemplateRule
public LicenseTemplateRule(String parseableLicenseTemplateRule) throws LicenseTemplateRuleException
Create a new License Template Rule by parsing a rule string compliant with the SPDX License Template text- Parameters:
parseableLicenseTemplateRule- license template rule string- Throws:
LicenseTemplateRuleException- if the license template could not be parsed
-
LicenseTemplateRule
public LicenseTemplateRule(String ruleName, LicenseTemplateRule.RuleType ruleType) throws LicenseTemplateRuleException
- Parameters:
ruleName- rule nameruleType- rule type- Throws:
LicenseTemplateRuleException- if the license template could not be parsed
-
-
Method Detail
-
validate
public void validate() throws LicenseTemplateRuleExceptionValidates that the LicenseTemplateRule is properly initialized- Throws:
LicenseTemplateRuleException- if the license template could not be parsed
-
parseLicenseTemplateRule
public void parseLicenseTemplateRule(String parseableLicenseTemplateRule) throws LicenseTemplateRuleException
Parse a license template rule string compliant with the SPDX license template text and replace all properties with the parsed values- Parameters:
parseableLicenseTemplateRule- String representation of a license template rule- Throws:
LicenseTemplateRuleException- if the license template could not be parsed
-
getType
public LicenseTemplateRule.RuleType getType()
- Returns:
- rule type
-
setType
public void setType(LicenseTemplateRule.RuleType type)
- Parameters:
type- the type to set
-
getOriginal
public String getOriginal()
- Returns:
- the original
-
setOriginal
public void setOriginal(String original)
- Parameters:
original- the original to set
-
getName
public String getName()
- Returns:
- the name
-
setName
public void setName(String name)
- Parameters:
name- the name to set
-
getExample
public String getExample()
- Returns:
- the example
-
setExample
public void setExample(String example)
- Parameters:
example- the example to set
-
getMatch
public String getMatch()
- Returns:
- the match
-
setMatch
public void setMatch(String match)
- Parameters:
match- the match to set
-
-