Example usage for java.lang Runtime.RemoteObject getClass

List of usage examples for java.lang Runtime.RemoteObject getClass

Introduction

In this page you can find the example usage for java.lang Runtime.RemoteObject getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.facebook.stetho.inspector.protocol.module.DOM.java

@ChromeDevtoolsMethod
public ResolveNodeResponse resolveNode(JsonRpcPeer peer, JSONObject params) throws JsonRpcException {
    ResolveNodeRequest request = mObjectMapper.convertValue(params, ResolveNodeRequest.class);
    Object object = mObjectIdMapper.getObjectForId(request.nodeId);

    int mappedObjectId = Runtime.mapObject(peer, object);

    Runtime.RemoteObject remoteObject = new Runtime.RemoteObject();
    remoteObject.type = Runtime.ObjectType.OBJECT;
    remoteObject.subtype = Runtime.ObjectSubType.NODE;
    remoteObject.className = remoteObject.getClass().getName();
    remoteObject.value = null; // not a primitive
    remoteObject.description = null; // not sure what this does...
    remoteObject.objectId = String.valueOf(mappedObjectId);
    ResolveNodeResponse response = new ResolveNodeResponse();
    response.object = remoteObject;/*from w ww  . j a  v  a2s  .  c  o  m*/

    return response;
}