Class ClassModel
- java.lang.Object
-
- proguard.evaluation.value.object.model.ClassModel
-
- All Implemented Interfaces:
Model,ReflectiveModel<ClassModel>
public class ClassModel extends java.lang.Object implements ReflectiveModel<ClassModel>
AModelto track specific Clazz constants.
-
-
Field Summary
-
Fields inherited from interface proguard.evaluation.value.object.model.reflective.ReflectiveModel
log
-
-
Constructor Summary
Constructors Constructor Description ClassModel(java.lang.Class<?> clazz)Used for creating aClassModelfor any of the primitive classes.ClassModel(Clazz clazz)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)ClazzgetClazz()Use this in caseisPrimitive()is true.@Nullable java.lang.StringgetModeledClassName()java.lang.Class<?>getPrimitiveClass()Use this in caseisPrimitive()is false.@NotNull java.lang.StringgetType()Returns the type of the modeled class.inthashCode()MethodResultinit(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)Execute a constructor call for the modeled class.booleanisPrimitive()java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface proguard.evaluation.value.object.model.reflective.ReflectiveModel
invoke, invokeStatic
-
-
-
-
Constructor Detail
-
ClassModel
public ClassModel(Clazz clazz)
-
ClassModel
public ClassModel(java.lang.Class<?> clazz)
Used for creating aClassModelfor any of the primitive classes.- Parameters:
clazz- one of the primitive classes.int.class,boolean.class, ...- Throws:
java.lang.IllegalArgumentException- iff a non-primitiveClassobject is passed.
-
-
Method Detail
-
getClazz
public Clazz getClazz()
Use this in caseisPrimitive()is true. Otherwise, usegetPrimitiveClass()- Returns:
- the modeled
Clazz. - Throws:
java.lang.IllegalArgumentException- if a primitive class is modeled.
-
getPrimitiveClass
public java.lang.Class<?> getPrimitiveClass()
Use this in caseisPrimitive()is false. Otherwise, usegetClazz().- Returns:
- the modeled
Class. - Throws:
java.lang.IllegalArgumentException- if a non-primitive class is modeled.
-
isPrimitive
public boolean isPrimitive()
-
getModeledClassName
@Nullable public @Nullable java.lang.String getModeledClassName()
- Returns:
- the name of the modeled class.
-
getType
@NotNull public @NotNull java.lang.String getType()
Description copied from interface:ModelReturns the type of the modeled class.
-
init
public MethodResult init(MethodExecutionInfo methodExecutionInfo, ValueCalculator valueCalculator)
Description copied from interface:ModelExecute a constructor call for the modeled class.It is suggested to add logic to allow running this only on a dummy model without any state.
- Specified by:
initin interfaceModel- Specified by:
initin interfaceReflectiveModel<ClassModel>- Parameters:
methodExecutionInfo- execution info of the target method.valueCalculator- the value calculator that should be used to create any value in the result.- Returns:
- the result of the method invocation. Since it's a constructor invocation the return value of the result is expected to be empty and the constructed value should be set as the updated instance.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-