APIdia Launch Partner
Top Description Fields Constructors Methods
sun.jvm.hotspot.runtime

public Class VirtualConstructor

extends InstanceConstructor<VMObject>
Class Inheritance
Imports
java.util.*, sun.jvm.hotspot.debugger.*, sun.jvm.hotspot.types.*

This class provides generalized "virtual constructor" functionality for VMObjects. In simple terms, it creates correctly-typed Java wrapper objects for underlying Addresses, using the "RTTI-like" functionality of TypeDataBase. For example, if the given Address really is a DefNewGeneration*, the Java object created for it will be of type sun.jvm.hotspot.memory.DefNewGeneration, assuming the mapping from type "DefNewGeneration" to class sun.jvm.hotspot.memory.DefNewGeneration has been set up.

Field Summary

Modifier and TypeField and Description
private TypeDataBase
private Map<String, Class<? extends VMObject>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
addMapping(String cTypeName, Class<? extends VMObject> clazz)

Adds a mapping from the given C++ type name to the given Java class.

public VMObject
instantiateWrapperFor(Address addr)

Implements abstract sun.jvm.hotspot.runtime.InstanceConstructor.instantiateWrapperFor.

Instantiate the most-precisely typed wrapper object available for the type of the given Address.

Inherited from sun.jvm.hotspot.runtime.InstanceConstructor:
newWrongTypeException

Field Detail

dbback to summary
private TypeDataBase db
mapback to summary
private Map<String, Class<? extends VMObject>> map

Constructor Detail

VirtualConstructorback to summary
public VirtualConstructor(TypeDataBase db)

Method Detail

addMappingback to summary
public boolean addMapping(String cTypeName, Class<? extends VMObject> clazz)

Adds a mapping from the given C++ type name to the given Java class. The latter must be a subclass of sun.jvm.hotspot.runtime.VMObject. Returns false if there was already a class for this type name in the map.

instantiateWrapperForback to summary
public VMObject instantiateWrapperFor(Address addr) throws WrongTypeException

Implements abstract sun.jvm.hotspot.runtime.InstanceConstructor.instantiateWrapperFor.

Instantiate the most-precisely typed wrapper object available for the type of the given Address. If no type in the mapping matched the type of the Address, throws a WrongTypeException. Returns null for a null address (similar behavior to VMObjectFactory).