org.chromium.sdk/src/org/chromium/sdk/JsObject.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;
       
     6 
       
     7 import java.util.Collection;
       
     8 
       
     9 import org.chromium.sdk.internal.tools.v8.MethodIsBlockingException;
       
    10 
       
    11 /**
       
    12  * A compound JsValue that has zero or more properties.
       
    13  */
       
    14 public interface JsObject extends JsValue {
       
    15 
       
    16   /**
       
    17    * @return the class name of this object
       
    18    */
       
    19   String getClassName();
       
    20 
       
    21   /**
       
    22    * @return the properties of this compound value
       
    23    * @throws MethodIsBlockingException if called from a callback because it may
       
    24    *         need to load value from remote
       
    25    */
       
    26   Collection<? extends JsVariable> getProperties() throws MethodIsBlockingException;
       
    27 
       
    28   /**
       
    29    * @return the internal properties of this compound value (e.g. those properties which
       
    30    *         are not detectable with the "in" operator: __proto__ etc)
       
    31    * @throws MethodIsBlockingException if called from a callback because it may
       
    32    *         need to load value from remote
       
    33    */
       
    34   Collection<? extends JsVariable> getInternalProperties() throws MethodIsBlockingException;
       
    35 
       
    36   /**
       
    37    * @param name of the property to get
       
    38    * @return the property object or {@code null} if {@code name} does not
       
    39    *         designate an existing object property
       
    40    */
       
    41   JsVariable getProperty(String name);
       
    42 
       
    43   /**
       
    44    * @return this object cast to {@link JsArray} or {@code null} if this object
       
    45    *         is not an array
       
    46    */
       
    47   JsArray asArray();
       
    48 
       
    49   /**
       
    50    * @return this object cast to {@link JsFunction} or {@code null} if this object
       
    51    *         is not a function
       
    52    */
       
    53   JsFunction asFunction();
       
    54 
       
    55   /**
       
    56    * Optionally returns unique id for this object. No two distinct objects can have the same id.
       
    57    * Lifetime of id may be limited by lifetime of {@link DebugContext}.
       
    58    * @return object id or null
       
    59    */
       
    60   String getRefId();
       
    61 }