Class MetadataBuilder
- java.lang.Object
-
- org.jboss.windup.config.metadata.AbstractRulesetMetadata
-
- org.jboss.windup.config.metadata.MetadataBuilder
-
- All Implemented Interfaces:
RuleProviderMetadata,RulesetMetadata
public class MetadataBuilder extends AbstractRulesetMetadata implements RuleProviderMetadata
Fluent builder for creatingRuleProviderMetadatainstances. Provides sensible defaults using given required values.If
RulesetMetadatais available in theAddonin which thisMetadataBuilderwas constructed, this will inherit values fromRulesetMetadataforgetTags(),getSourceTechnologies(),getTargetTechnologies()andgetRequiredAddons().Inherited metadata is specified by
setRulesetMetadata(RulesetMetadata), and is typically performed by theRuleProviderLoaderimplementation.- Author:
- Lincoln Baxter, III
-
-
Field Summary
Fields Modifier and Type Field Description static Class<? extends RulePhase>DEFAULT_PHASE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MetadataBuilderaddExecuteAfter(Class<? extends RuleProvider> type)Ad an entry to the list ofRuleProviderclasses that should execute after theRuleinstances in the correspondingRuleProviderinstance.MetadataBuilderaddExecuteAfterId(String id)Add an entry to the list of theRuleProviderclasses that should execute before theRuleinstances in the correspondingRuleProviderinstance.MetadataBuilderaddExecuteBefore(Class<? extends RuleProvider> type)Ad an entry to the list ofRuleProviderclasses that should execute after theRuleinstances in the correspondingRuleProviderinstance.MetadataBuilderaddExecuteBeforeId(String id)Add to the list of theRuleProviderclasses that should execute after theRuleinstances in the correspondingRuleProviderinstance.MetadataBuilderaddRequiredAddon(org.jboss.forge.furnace.addons.AddonId reference)Add to theSetofAddons required to run this rule-set.MetadataBuilderaddSourceTechnology(TechnologyReference reference)MetadataBuilderaddTag(String tag)MetadataBuilderaddTags(String tag, String... tags)Add to theSetof tags by which thisRulesetMetadatais classified.MetadataBuilderaddTargetTechnology(TechnologyReference reference)booleanequals(Object o)static MetadataBuilderforProvider(Class<? extends RuleProvider> implementationType)Create a newRuleProviderMetadatabuilder instance for the givenRuleProvidertype, using the provided parameters andRulesetMetadatato seed sensible defaults.static MetadataBuilderforProvider(Class<? extends RuleProvider> implementationType, String providerId)Create a newRuleProviderMetadatabuilder instance for the givenRuleProvidertype, andStringID, using the provided parameters andRulesetMetadatato seed sensible defaults.StringgetDescription()Returns a human-readable description the rules associated with thisRulesetMetadata.List<Class<? extends RuleProvider>>getExecuteAfter()Returns a list ofRuleProviderclasses that should execute before theRuleinstances in this correspondingRuleProvider.List<String>getExecuteAfterIDs()Returns a list of theRuleProviderclasses that should execute before theRules in thisRuleProvider.List<Class<? extends RuleProvider>>getExecuteBefore()List<String>getExecuteBeforeIDs()Returns a list of theRuleProviderclasses that should execute after theRules in thisRuleProvider.StringgetOrigin()Returns a descriptiveString, informing a human where they can find theRuleinstances provided by thisRuleProvider.Class<? extends RulePhase>getPhase()Set<org.jboss.forge.furnace.addons.AddonId>getRequiredAddons()Return theSetofAddons required to run this rule-set.RulesetMetadatagetRulesetMetadata()Returns theRulesetMetadata, if any, for the rule-set from which thisRuleProviderMetadataoriginated.Set<TechnologyReference>getSourceTechnologies()Set<String>getTags()Return theSetof tags by which thisRulesetMetadatais classified.Set<TechnologyReference>getTargetTechnologies()Class<? extends RuleProvider>getType()Returns theClassof the correspondingRuleProvider.inthashCode()booleanisDisabled()If true, Windup will skip running this RuleProvider.booleanisHaltOnException()Whether Windup should stop execution if this provider's rule execution ends with an exception.booleanisOverrideProvider()Indicates whether or not the rules in this provider should override other rules.MetadataBuildersetDescription(String description)Sets the human readable description.MetadataBuildersetExecuteAfter(List<Class<? extends RuleProvider>> executeAfter)Set the list ofRuleProviderclasses that should execute before theRuleinstances in the correspondingRuleProviderinstance.MetadataBuildersetExecuteAfterIDs(List<String> executeAfterIDs)Set the list of theRuleProviderclasses that should execute before theRuleinstances in the correspondingRuleProviderinstance.MetadataBuildersetExecuteBefore(List<Class<? extends RuleProvider>> executeBefore)Set the list ofRuleProviderclasses that should execute after theRuleinstances in the correspondingRuleProviderinstance.MetadataBuildersetExecuteBeforeIDs(List<String> executeBeforeIDs)Set the list of theRuleProviderclasses that should execute after theRuleinstances in the correspondingRuleProviderinstance.MetadataBuildersetHaltOnException(boolean haltOnException)Whether Windup should stop execution if this provider's rule execution ends with an exception.MetadataBuildersetOrigin(String origin)Set the descriptive information indicating where the correspondingRuleProviderinstance is located (eg, a path to an XML file on disk, or anAddoncoordinate and class name).MetadataBuildersetOverrideProvider(boolean overrideProvider)Sets whether or not this provider's rules should override rules from other providers with the same ID.MetadataBuildersetPhase(Class<? extends RulePhase> phase)Set theRulePhasein which theRuleinstances from the correspondingRuleProviderinstance should be executed.MetadataBuildersetRulesetMetadata(RulesetMetadata parent)MetadataBuildersetTags(List<String> tags)Set the tags by which thisRulesetMetadatais classified.-
Methods inherited from class org.jboss.windup.config.metadata.AbstractRulesetMetadata
getID, hasTags, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jboss.windup.config.metadata.RulesetMetadata
getID, hasTags
-
-
-
-
Method Detail
-
forProvider
public static MetadataBuilder forProvider(Class<? extends RuleProvider> implementationType)
Create a newRuleProviderMetadatabuilder instance for the givenRuleProvidertype, using the provided parameters andRulesetMetadatato seed sensible defaults.
-
forProvider
public static MetadataBuilder forProvider(Class<? extends RuleProvider> implementationType, String providerId)
Create a newRuleProviderMetadatabuilder instance for the givenRuleProvidertype, andStringID, using the provided parameters andRulesetMetadatato seed sensible defaults.
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classAbstractRulesetMetadata
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractRulesetMetadata
-
getType
public Class<? extends RuleProvider> getType()
Description copied from interface:RuleProviderMetadataReturns theClassof the correspondingRuleProvider.- Specified by:
getTypein interfaceRuleProviderMetadata
-
getRulesetMetadata
public RulesetMetadata getRulesetMetadata()
Description copied from interface:RuleProviderMetadataReturns theRulesetMetadata, if any, for the rule-set from which thisRuleProviderMetadataoriginated.- Specified by:
getRulesetMetadatain interfaceRuleProviderMetadata
-
setRulesetMetadata
public MetadataBuilder setRulesetMetadata(RulesetMetadata parent)
-
isOverrideProvider
public boolean isOverrideProvider()
Description copied from interface:RuleProviderMetadataIndicates whether or not the rules in this provider should override other rules. If this ruleprovider has the same ID as another rule provider, then any rules in this provider will override rules from that base rule provider that have the same id.- Specified by:
isOverrideProviderin interfaceRuleProviderMetadata
-
setOverrideProvider
public MetadataBuilder setOverrideProvider(boolean overrideProvider)
Sets whether or not this provider's rules should override rules from other providers with the same ID.
-
getOrigin
public String getOrigin()
Description copied from interface:RulesetMetadataReturns a descriptiveString, informing a human where they can find theRuleinstances provided by thisRuleProvider.- Specified by:
getOriginin interfaceRulesetMetadata- Overrides:
getOriginin classAbstractRulesetMetadata
-
setOrigin
public MetadataBuilder setOrigin(String origin)
Set the descriptive information indicating where the correspondingRuleProviderinstance is located (eg, a path to an XML file on disk, or anAddoncoordinate and class name).
-
getPhase
public Class<? extends RulePhase> getPhase()
Description copied from interface:RuleProviderMetadataReturn theRulePhasein whichRuleinstances from thisRuleProvidershould be executed.The default phase is
MigrationRulesPhase.- Specified by:
getPhasein interfaceRuleProviderMetadata
-
setPhase
public MetadataBuilder setPhase(Class<? extends RulePhase> phase)
Set theRulePhasein which theRuleinstances from the correspondingRuleProviderinstance should be executed.The default phase is
MigrationRulesPhase.
-
getExecuteAfter
public List<Class<? extends RuleProvider>> getExecuteAfter()
Description copied from interface:RuleProviderMetadataReturns a list ofRuleProviderclasses that should execute before theRuleinstances in this correspondingRuleProvider.RuleProviders can also be specified based on id (RuleProviderMetadata.getExecuteAfterIDs()).- Specified by:
getExecuteAfterin interfaceRuleProviderMetadata
-
setExecuteAfter
public MetadataBuilder setExecuteAfter(List<Class<? extends RuleProvider>> executeAfter)
Set the list ofRuleProviderclasses that should execute before theRuleinstances in the correspondingRuleProviderinstance.RuleProviderreferences can also be specified based on id (getExecuteAfterIDs()).
-
addExecuteAfter
public MetadataBuilder addExecuteAfter(Class<? extends RuleProvider> type)
Ad an entry to the list ofRuleProviderclasses that should execute after theRuleinstances in the correspondingRuleProviderinstance.RuleProviders can also be specified based on id (getExecuteBeforeIDs()).
-
setDescription
public MetadataBuilder setDescription(String description)
Sets the human readable description.
-
getDescription
public String getDescription()
Description copied from interface:RulesetMetadataReturns a human-readable description the rules associated with thisRulesetMetadata.- Specified by:
getDescriptionin interfaceRulesetMetadata- Overrides:
getDescriptionin classAbstractRulesetMetadata
-
getExecuteAfterIDs
public List<String> getExecuteAfterIDs()
Description copied from interface:RuleProviderMetadataReturns a list of theRuleProviderclasses that should execute before theRules in thisRuleProvider. This is returned as a list ofRuleIDs in order to support extensions that cannot depend on each other via class names. For example, in the case of the Groovy rules extension, a single class covers many rules with their own IDs. For specifying Java-based rules,RuleProviderMetadata.getExecuteAfter()is preferred.- Specified by:
getExecuteAfterIDsin interfaceRuleProviderMetadata
-
setExecuteAfterIDs
public MetadataBuilder setExecuteAfterIDs(List<String> executeAfterIDs)
Set the list of theRuleProviderclasses that should execute before theRuleinstances in the correspondingRuleProviderinstance.This is returned as a list of Rule IDs in order to support extensions that cannot depend on each other via class names. For example, in the case of the Groovy rules extension, a single class covers many rules with their own IDs. For specifying Java-based rules,
getExecuteAfter()is preferred.
-
addExecuteAfterId
public MetadataBuilder addExecuteAfterId(String id)
Add an entry to the list of theRuleProviderclasses that should execute before theRuleinstances in the correspondingRuleProviderinstance.This is returned as a list of Rule IDs in order to support extensions that cannot depend on each other via class names. For example, in the case of the Groovy rules extension, a single class covers many rules with their own IDs. For specifying Java-based rules,
getExecuteAfter()is preferred.
-
getExecuteBefore
public List<Class<? extends RuleProvider>> getExecuteBefore()
Description copied from interface:RuleProviderMetadataReturns a list ofRuleProviderclasses that should execute after theRules in thisRuleProvider.RuleProviders can also be specified based on id (RuleProviderMetadata.getExecuteBeforeIDs()).- Specified by:
getExecuteBeforein interfaceRuleProviderMetadata
-
setExecuteBefore
public MetadataBuilder setExecuteBefore(List<Class<? extends RuleProvider>> executeBefore)
Set the list ofRuleProviderclasses that should execute after theRuleinstances in the correspondingRuleProviderinstance.RuleProviders can also be specified based on id (getExecuteBeforeIDs()).
-
addExecuteBefore
public MetadataBuilder addExecuteBefore(Class<? extends RuleProvider> type)
Ad an entry to the list ofRuleProviderclasses that should execute after theRuleinstances in the correspondingRuleProviderinstance.RuleProviders can also be specified based on id (getExecuteBeforeIDs()).
-
getExecuteBeforeIDs
public List<String> getExecuteBeforeIDs()
Description copied from interface:RuleProviderMetadataReturns a list of theRuleProviderclasses that should execute after theRules in thisRuleProvider. This is returned as a list ofRuleIDs in order to support extensions that cannot depend on each other viaClassnames. For example, in the case of the Groovy rules extension, a single class covers many rules with their own IDs. For specifying Java-based rules,RuleProviderMetadata.getExecuteBefore()is preferred.- Specified by:
getExecuteBeforeIDsin interfaceRuleProviderMetadata
-
setExecuteBeforeIDs
public MetadataBuilder setExecuteBeforeIDs(List<String> executeBeforeIDs)
Set the list of theRuleProviderclasses that should execute after theRuleinstances in the correspondingRuleProviderinstance.This is returned as a list of Rule IDs in order to support extensions that cannot depend on each other via class names. For example, in the case of the Groovy rules extension, a single class covers many rules with their own IDs. For specifying Java-based rules,
getExecuteBefore()is preferred.
-
addExecuteBeforeId
public MetadataBuilder addExecuteBeforeId(String id)
Add to the list of theRuleProviderclasses that should execute after theRuleinstances in the correspondingRuleProviderinstance.This is returned as a list of Rule IDs in order to support extensions that cannot depend on each other via class names. For example, in the case of the Groovy rules extension, a single class covers many rules with their own IDs. For specifying Java-based rules,
getExecuteBefore()is preferred.
-
addTags
public MetadataBuilder addTags(String tag, String... tags)
Add to theSetof tags by which thisRulesetMetadatais classified.Inherits from
RulesetMetadata.getTags()if available.
-
addTag
public MetadataBuilder addTag(String tag)
-
getTags
public Set<String> getTags()
Description copied from interface:RulesetMetadataReturn theSetof tags by which thisRulesetMetadatais classified.- Specified by:
getTagsin interfaceRulesetMetadata- Overrides:
getTagsin classAbstractRulesetMetadata
-
setTags
public MetadataBuilder setTags(List<String> tags)
Set the tags by which thisRulesetMetadatais classified.Inherits from
RulesetMetadata.getTags()if available.
-
getSourceTechnologies
public Set<TechnologyReference> getSourceTechnologies()
Description copied from interface:RulesetMetadata- Specified by:
getSourceTechnologiesin interfaceRulesetMetadata- Overrides:
getSourceTechnologiesin classAbstractRulesetMetadata
-
addSourceTechnology
public MetadataBuilder addSourceTechnology(TechnologyReference reference)
Add to theSetof sourceTechnologyReferenceinstances to which thisRuleProvideris related.Inherits from
RulesetMetadata.getSourceTechnologies()if available.
-
getTargetTechnologies
public Set<TechnologyReference> getTargetTechnologies()
Description copied from interface:RulesetMetadata- Specified by:
getTargetTechnologiesin interfaceRulesetMetadata- Overrides:
getTargetTechnologiesin classAbstractRulesetMetadata
-
addTargetTechnology
public MetadataBuilder addTargetTechnology(TechnologyReference reference)
Add to theSetof targetTechnologyReferenceinstances to which thisRuleProvideris related.Inherits from
RulesetMetadata.getTargetTechnologies()if available.
-
getRequiredAddons
public Set<org.jboss.forge.furnace.addons.AddonId> getRequiredAddons()
Description copied from interface:RulesetMetadataReturn theSetofAddons required to run this rule-set. (Note: This is typically only used in situations where rules are provided externally - such as XML - whereas in Java, theAddonwill already define its dependencies on other addons directly.)- Specified by:
getRequiredAddonsin interfaceRulesetMetadata- Overrides:
getRequiredAddonsin classAbstractRulesetMetadata
-
addRequiredAddon
public MetadataBuilder addRequiredAddon(org.jboss.forge.furnace.addons.AddonId reference)
Add to theSetofAddons required to run this rule-set. (Note: This is typically only used in situations where rules are provided externally - such as XML - whereas in Java, theAddonwill already define its dependencies on other addons directly.)Inherits from
RulesetMetadata.getRequiredAddons()if available.
-
setHaltOnException
public MetadataBuilder setHaltOnException(boolean haltOnException)
Whether Windup should stop execution if this provider's rule execution ends with an exception. By default, the exceptions are only logged and the failing rule appears in report. The rule itself is responsible for handling exceptions and storing them into the graph.
-
isHaltOnException
public boolean isHaltOnException()
Description copied from interface:RuleProviderMetadataWhether Windup should stop execution if this provider's rule execution ends with an exception. By default, the exceptions are only logged and the failing rule appears in report. The rule itself is responsible for handling exceptions and storing them into the graph.- Specified by:
isHaltOnExceptionin interfaceRuleProviderMetadata
-
isDisabled
public boolean isDisabled()
Description copied from interface:RuleProviderMetadataIf true, Windup will skip running this RuleProvider. Meant for development purposes.- Specified by:
isDisabledin interfaceRuleProviderMetadata
-
-