Interface VariableValueParameters.Factory
-
- Enclosing class:
- VariableValueParameters
public static interface VariableValueParameters.FactoryA factory that createsValueParameters or their builders.
-
-
Method Summary
-
-
-
Method Detail
-
createEnumParameter
<T extends Enum<T>> ValueParameter<T> createEnumParameter(Class<T> enumClass)
Creates theValueParameterfor the specifiedEnum- Type Parameters:
T- The type ofEnum- Parameters:
enumClass- TheEnumtype to base the choices on- Returns:
- The
ValueParameter
-
createStaticChoicesBuilder
<T> VariableValueParameters.StaticChoicesBuilder<T> createStaticChoicesBuilder(Class<T> returnType)
Creates theVariableValueParameters.StaticChoicesBuilderthat will create objects that parse objects and return results of typeT.- Type Parameters:
T- The parser return type- Parameters:
returnType- TheClassofT- Returns:
- The builder
-
createDynamicChoicesBuilder
<T> VariableValueParameters.DynamicChoicesBuilder<T> createDynamicChoicesBuilder(Class<T> returnType)
Creates theVariableValueParameters.DynamicChoicesBuilderthat will create objects that parse objects and return results of typeT.- Type Parameters:
T- The parser return type- Parameters:
returnType- TheClassofT- Returns:
- The builder
-
createRegistryEntryBuilder
<T> VariableValueParameters.RegistryEntryBuilder<T> createRegistryEntryBuilder(RegistryType<T> registryKey)
Creates aVariableValueParameters.RegistryEntryBuilderthat retrieves objects from theRegistryrepresented by the givenRegistryKeyand the providedRegistryHolder, which may be determined by the current state of theCommandContext.This element can support multiple functions that return
RegistryHolders, however order matters, theRegistryfrom the first holder that is resolved will be used. Holders may be added viaVariableValueParameters.RegistryEntryBuilder.addHolderFunction(Function).- Type Parameters:
T- The type that the targetRegistryholds- Parameters:
registryKey- TheRegistryKeythat represents the targetRegistryin theRegistryHolderprovided viaholderProvider.- Returns:
- The
VariableValueParameters.RegistryEntryBuilder
-
createRegistryEntryBuilder
<T> VariableValueParameters.RegistryEntryBuilder<T> createRegistryEntryBuilder(List<Function<CommandContext,@Nullable RegistryHolder>> holderProvider, RegistryType<T> registryKey)
Creates aVariableValueParameters.RegistryEntryBuilderthat retrieves objects from theRegistryrepresented by the givenRegistryKeyand the providedRegistryHolder, which may be determined by the current state of theCommandContext.This element can support multiple functions that return
RegistryHolders, however order matters, theRegistryfrom the first holder that is resolved will be used. Beyond the holders provided in this function, additional functions that resolve holders can be added throughVariableValueParameters.RegistryEntryBuilder.addHolderFunction(Function).GameandServerscopedRegistryHolderproviders are available viaVariableValueParameters.RegistryEntryBuilder.GLOBAL_HOLDER_PROVIDERandVariableValueParameters.RegistryEntryBuilder.SERVER_HOLDER_PROVIDER.Worldscoped providers are available viaVariableValueParameters.RegistryEntryBuilder.WORLD_FROM_CAUSE_HOLDER_PROVIDERandVariableValueParameters.RegistryEntryBuilder.WORLD_FROM_LOCATABLE_HOLDER_PROVIDER.- Type Parameters:
T- The type that the targetRegistryholds- Parameters:
holderProvider- AFunctionthat provides aRegistryHolderbased on theCommandContextup to this parameter.registryKey- TheRegistryKeythat represents the targetRegistryin theRegistryHolderprovided viaholderProvider.- Returns:
- The
VariableValueParameters.RegistryEntryBuilder
-
createRegistryEntryBuilder
<T> VariableValueParameters.RegistryEntryBuilder<T> createRegistryEntryBuilder(DefaultedRegistryType<T> type)
Creates aVariableValueParameters.RegistryEntryBuilderthat retrieves objects from the providedDefaultedRegistryReference, which retrieves an object from the appropriateRegistry.- Type Parameters:
T- The type that the targetRegistryholds- Parameters:
type- The registry type- Returns:
- The
VariableValueParameters.RegistryEntryBuilder
-
createLiteralBuilder
<T> VariableValueParameters.LiteralBuilder<T> createLiteralBuilder(Class<T> returnType)
Creates theVariableValueParameters.LiteralBuilderthat will create objects that parse objects and return results of typeT.- Type Parameters:
T- The parser return type- Parameters:
returnType- TheClassofT- Returns:
- The builder
-
createIntegerNumberRangeBuilder
VariableValueParameters.NumberRangeBuilder<Integer> createIntegerNumberRangeBuilder()
Creates aVariableValueParameters.NumberRangeBuilderfor integer values.- Returns:
- The
VariableValueParameters.NumberRangeBuilder
-
createFloatNumberRangeBuilder
VariableValueParameters.NumberRangeBuilder<Float> createFloatNumberRangeBuilder()
Creates aVariableValueParameters.NumberRangeBuilderfor float values.- Returns:
- The
VariableValueParameters.NumberRangeBuilder
-
createDoubleNumberRangeBuilder
VariableValueParameters.NumberRangeBuilder<Double> createDoubleNumberRangeBuilder()
Creates aVariableValueParameters.NumberRangeBuilderfor double values.- Returns:
- The
VariableValueParameters.NumberRangeBuilder
-
createLongNumberRangeBuilder
VariableValueParameters.NumberRangeBuilder<Long> createLongNumberRangeBuilder()
Creates aVariableValueParameters.NumberRangeBuilderfor long values.- Returns:
- The
VariableValueParameters.NumberRangeBuilder
-
createValidatedStringParameter
ValueParameter<String> createValidatedStringParameter(Pattern pattern)
Creates aValueParameterthat validates its input against aPattern.- Parameters:
pattern- ThePattern- Returns:
- The
ValueParameter
-
-