Class ReferenceChain
- java.lang.Object
-
- org.openjdk.jmc.agent.util.expression.ReferenceChain
-
public final class ReferenceChain extends java.lang.Object
A ReferenceChain instance presents a field reference expression. eg.OuterClass.this.field.STATIC_FIELD
is a reference chain consisting elements: a qualified-this reference and two field reference (field
andSTATIC_FIELD
).
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<?>
callerClass
private java.util.List<ReferenceChainElement>
references
-
Constructor Summary
Constructors Constructor Description ReferenceChain(java.lang.Class<?> callerClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
append(ReferenceChainElement ref)
Appends a ReferenceChainElement to the chainjava.lang.Class<?>
getCallerClass()
java.util.List<ReferenceChainElement>
getReferences()
org.objectweb.asm.Type
getType()
boolean
isStatic()
ReferenceChain
normalize()
Reduces the reference chain to prepend "this" or qualified-this references if necessary, and short-circuits on static references
-
-
-
Field Detail
-
callerClass
private final java.lang.Class<?> callerClass
-
references
private final java.util.List<ReferenceChainElement> references
-
-
Method Detail
-
getCallerClass
public java.lang.Class<?> getCallerClass()
- Returns:
- the caller class making this reference
-
getReferences
public java.util.List<ReferenceChainElement> getReferences()
- Returns:
- all elements on the reference chain
-
normalize
public ReferenceChain normalize()
Reduces the reference chain to prepend "this" or qualified-this references if necessary, and short-circuits on static references- Returns:
- the normalized reference chain
-
getType
public org.objectweb.asm.Type getType()
- Returns:
- the type of the last reference element
-
append
public void append(ReferenceChainElement ref)
Appends a ReferenceChainElement to the chain- Parameters:
ref
- ReferenceChainElement to be appended
-
isStatic
public boolean isStatic()
- Returns:
- whether the reference is valid from a static context
-
-