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 class
LicenseTemplateRule.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 String
getExample()
String
getMatch()
String
getName()
String
getOriginal()
LicenseTemplateRule.RuleType
getType()
void
parseLicenseTemplateRule(String parseableLicenseTemplateRule)
Parse a license template rule string compliant with the SPDX license template text and replace all properties with the parsed valuesvoid
setExample(String example)
void
setMatch(String match)
void
setName(String name)
void
setOriginal(String original)
void
setType(LicenseTemplateRule.RuleType type)
String
toString()
void
validate()
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 LicenseTemplateRuleException
Validates 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
-
-