Package proguard.evaluation
Interface ValueCalculator
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ValueCalculator
This functional interface can be used to specify a way of creatingValue
s given a series of parameters.For now this is split from
ValueFactory
and the function can be implemented in a way that all the calls to the specific value factory methods go through the same function. It could be argued that instead of having a functional interface this could be a new method inValueFactory
, but until something like this is needed in different location having a separate function looks cleaner.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Value
apply(@NotNull java.lang.String type, @Nullable Clazz referencedClass, boolean isParticular, @Nullable java.lang.Object concreteValue, boolean valueMayBeExtension, @Nullable java.lang.Object valueId)
-
-
-
Method Detail
-
apply
Value apply(@NotNull @NotNull java.lang.String type, @Nullable @Nullable Clazz referencedClass, boolean isParticular, @Nullable @Nullable java.lang.Object concreteValue, boolean valueMayBeExtension, @Nullable @Nullable java.lang.Object valueId)
Create aValue
given all available known information about it (included the actual tracked value or aModel
of it, if available, and its reference identifier if the value has the same reference as an existing one).This method is not limited to particular value and can be used to create any value given the available amount of information.
- Parameters:
type
- the static type of the created value (runtime type might implement/extend it).referencedClass
- theClazz
of the value (if it's a reference value).isParticular
- whether the value to create is particular. If not the `concreteValue` parameter will be ignored.concreteValue
- the value of the tracked object. Can be the actual value or aModel
.valueMayBeExtension
- whether the created value might actually be an extension of the type. This should always be false for the instance created by constructors since they always create an object of the exact type. This should usually beClassUtil.isExtendable(Clazz)
for non constructor calls or more precise information if the caller is able to provide it.valueId
- the already known reference identifier of the created value. Null if the identifier was not previously known. This is particularly important for constructors, since they always return void and the only way to associate the constructed object to its existing references is via the valueId.- Returns:
- The
Value
corresponding to the given parameters.
-
-