Record Class ExpressionArgument<ENVIRONMENT extends IScratchEnvironment,TYPE>
java.lang.Object
java.lang.Record
com.petrolpark.core.scratch.argument.ExpressionArgument<ENVIRONMENT,TYPE>
- All Implemented Interfaces:
IScratchArgument<ENVIRONMENT,,TYPE> IScratchContextHolder
public record ExpressionArgument<ENVIRONMENT extends IScratchEnvironment,TYPE> (ExpressionAndArguments<? super ENVIRONMENT extends IScratchEnvironment,TYPE,?> expressionAndArguments, ExpressionArgument.ExpressionParameter<? super ENVIRONMENT extends IScratchEnvironment,TYPE> parameter)
extends Record
implements IScratchArgument<ENVIRONMENT,TYPE>, IScratchContextHolder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class -
Constructor Summary
ConstructorsConstructorDescriptionExpressionArgument(ExpressionAndArguments<? super ENVIRONMENT, TYPE, ?> expressionAndArguments, ExpressionArgument.ExpressionParameter<? super ENVIRONMENT, TYPE> parameter) Creates an instance of aExpressionArgumentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether this Argument can evaluate without crashing.final booleanIndicates whether some other object is "equal to" this one.ExpressionAndArguments<? super ENVIRONMENT, TYPE, ?> Returns the value of theexpressionAndArgumentsrecord component.get(ENVIRONMENT environment) final inthashCode()Returns a hash code value for this object.static final <TYPE> ExpressionArgument.ExpressionParameter<IScratchEnvironment, List<TYPE>> listParameter(String key, IScratchClass<TYPE, ?> scratchClass) Returns the value of theparameterrecord component.static final <ENVIRONMENT extends IScratchEnvironment,TYPE>
ExpressionArgument.ExpressionParameter<ENVIRONMENT, TYPE> parameter(String key, IScratchClass<TYPE, ?> scratchClass) <CONTEXT extends IScratchContext<CONTEXT>>
voidpopulateContext(IScratchContextProvider<CONTEXT> contextProvider, CONTEXT context) final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ExpressionArgument
public ExpressionArgument(ExpressionAndArguments<? super ENVIRONMENT, TYPE, ?> expressionAndArguments, ExpressionArgument.ExpressionParameter<? super ENVIRONMENT, TYPE> parameter) Creates an instance of aExpressionArgumentrecord class.- Parameters:
expressionAndArguments- the value for theexpressionAndArgumentsrecord componentparameter- the value for theparameterrecord component
-
-
Method Details
-
parameter
public static final <ENVIRONMENT extends IScratchEnvironment,TYPE> ExpressionArgument.ExpressionParameter<ENVIRONMENT,TYPE> parameter(String key, IScratchClass<TYPE, ?> scratchClass) -
listParameter
public static final <TYPE> ExpressionArgument.ExpressionParameter<IScratchEnvironment,List<TYPE>> listParameter(String key, IScratchClass<TYPE, ?> scratchClass) -
get
- Specified by:
getin interfaceIScratchArgument<ENVIRONMENT extends IScratchEnvironment,TYPE>
-
canEvaluate
public boolean canEvaluate()Description copied from interface:IScratchArgumentWhether this Argument can evaluate without crashing.- Specified by:
canEvaluatein interfaceIScratchArgument<ENVIRONMENT extends IScratchEnvironment,TYPE>
-
populateContext
public <CONTEXT extends IScratchContext<CONTEXT>> void populateContext(IScratchContextProvider<CONTEXT> contextProvider, CONTEXT context) - Specified by:
populateContextin interfaceIScratchContextHolder
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
expressionAndArguments
Returns the value of theexpressionAndArgumentsrecord component.- Returns:
- the value of the
expressionAndArgumentsrecord component
-
parameter
Returns the value of theparameterrecord component.- Specified by:
parameterin interfaceIScratchArgument<ENVIRONMENT extends IScratchEnvironment,TYPE> - Returns:
- the value of the
parameterrecord component
-