@Retention(value=CLASS)
@Target(value={METHOD,CONSTRUCTOR})
public @interface CModifyConstant
optional() is set to true.nullValue()).
This argument will be the original value of the constant.
@CModifyConstant(method = "print", stringValue = "test")
public String modifyConstant(String original) {
//Do something with the original value and return the new value
return original + "!";
}
If your target has to be chosen more precisely you can use a slice() to narrow down the search.CSlice| Modifier and Type | Required Element and Description |
|---|---|
java.lang.String[] |
method
The method name and descriptor to inject into.
|
| Modifier and Type | Optional Element and Description |
|---|---|
double |
doubleValue
Set the given double as the target.
|
float |
floatValue
Set the given float as the target.
|
int |
intValue
Set the given int as the target.
|
long |
longValue
Set the given long as the target.
|
boolean |
nullValue
Set
ACONST_NULL as the target. |
boolean |
optional
Make this injection optional.
|
int |
ordinal
The ordinal of target constant.
|
CSlice |
slice
The slice to narrow down the search for the target.
|
java.lang.String |
stringValue
Set the given String as the target.
|
java.lang.Class<?> |
typeValue
Set the given class as the target.
|
public abstract java.lang.String[] method
print(Ljava/lang/String;)V or print*public abstract int ordinal
public abstract CSlice slice
public abstract boolean optional
true.public abstract boolean nullValue
ACONST_NULL as the target.public abstract int intValue
public abstract long longValue
public abstract float floatValue
public abstract double doubleValue