org.chromium.sdk/src/org/chromium/sdk/internal/JsValueImpl.java
changeset 2 e4420d2515f1
equal deleted inserted replaced
1:ef76fc2ac88c 2:e4420d2515f1
       
     1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
       
     2 // Use of this source code is governed by a BSD-style license that can be
       
     3 // found in the LICENSE file.
       
     4 
       
     5 package org.chromium.sdk.internal;
       
     6 
       
     7 import org.chromium.sdk.JsValue;
       
     8 
       
     9 /**
       
    10  * A base class that represents a JavaScript VM variable value (compound values
       
    11  * are represented by subclasses.)
       
    12  */
       
    13 class JsValueImpl implements JsValue {
       
    14 
       
    15   /** The value data as reported by the JavaScript VM. */
       
    16   private final ValueMirror valueData;
       
    17 
       
    18   JsValueImpl(ValueMirror valueData) {
       
    19     this.valueData = valueData;
       
    20   }
       
    21 
       
    22   public Type getType() {
       
    23     return valueData.getType();
       
    24   }
       
    25 
       
    26   public String getValueString() {
       
    27     return valueData.toString();
       
    28   }
       
    29 
       
    30   public JsObjectImpl asObject() {
       
    31     return null;
       
    32   }
       
    33 
       
    34   public ValueMirror getMirror() {
       
    35     return this.valueData;
       
    36   }
       
    37 
       
    38   @Override
       
    39   public String toString() {
       
    40     return String.format("[JsValue: type=%s,value=%s]", getType(), getValueString());
       
    41   }
       
    42 }