Package io.github.jonloucks.variants.api
Class GlobalVariants
java.lang.Object
io.github.jonloucks.variants.api.GlobalVariants
Responsibility: Globally shared Variants
-
Method Summary
Modifier and TypeMethodDescriptionstatic EnvironmentcreateEnvironment(Environment.Config config) Create an Environment by configurationstatic EnvironmentcreateEnvironment(Consumer<Environment.Config.Builder> builderConsumer) Create an Environment by configuration builder callbackstatic <T> Variant<T>createVariant(Variant.Config<T> config) static <T> Variant<T>createVariant(Consumer<Variant.Config.Builder<T>> builderConsumer) Create a Variant by configuration builder callbackstatic VariantscreateVariants(Variants.Config config) Create a new Variants instance for customized deployments.static Optional<VariantsFactory>findVariantsFactory(Variants.Config config) Finds the VariantsFactory implementationstatic VariantsReturn the global instance of Contracts
-
Method Details
-
createVariant
Create a Variant by configuration builder callback- Type Parameters:
T- the Variant value type- Parameters:
builderConsumer- receives the configuration builder- Returns:
- the new Variant
-
createVariant
- Type Parameters:
T- the Variant value type- Parameters:
config- the configuration for creating the Variant- Returns:
- the new Variant
-
createEnvironment
Create an Environment by configuration- Parameters:
config- the configuration- Returns:
- the new Environment
-
createEnvironment
Create an Environment by configuration builder callback- Parameters:
builderConsumer- receives the configuration builder- Returns:
- the new Environment
-
getInstance
Return the global instance of Contracts- Returns:
- the instance
-
createVariants
Create a new Variants instance for customized deployments. Note: GlobalVariants has everything feature, this api allows creation of more than once instance of Variants.- Parameters:
config- the Variants configuration- Returns:
- the new Variants
- Throws:
IllegalArgumentException- if config is null or invalid- See Also:
-
findVariantsFactory
Finds the VariantsFactory implementation- Parameters:
config- the configuration used to find the factory- Returns:
- the factory if found
- Throws:
IllegalArgumentException- if config is null or invalid
-