flash.tools.debugger.Value Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package flash.tools.debugger;
import flash.tools.debugger.concrete.DVariable;
/**
* An ActionScript value, for example, the value of a variable or constant.
*
* @author mmorearty
*/
public interface Value
{
/**
* A special object representing ActionScript's "undefined" value.
*/
public static final Object UNDEFINED = new Object() {
@Override
public String toString() {
return "undefined"; //$NON-NLS-1$
}
};
/**
* The value returned if somone calls getId() for a Variable
* which stores a variable of simple type such as String or
* integer, rather than an Object or MovieClip.
* @see getId()
*/
public static final long UNKNOWN_ID = -1;
/**
* The special ID for pseudo-variable "_global". (Note, this only
* exists in AS2, not AS3.)
* @see getId()
*/
public static final long GLOBAL_ID = -2;
/**
* The special ID for pseudo-variable "this".
* @see getId()
*/
public static final long THIS_ID = -3;
/**
* The special ID for pseudo-variable "_root". (Note, this only
* exists in AS2, not AS3.)
* @see getId()
*/
public static final long ROOT_ID = -4;
/**
* The special ID for the top frame of the stack. Locals and
* arguments are "members" of this pseudo-variable.
*
* All the stack frames have IDs counting down from here. For example,
* the top stack frame has ID BASE_ID; the next
* stack frame has ID BASE_ID - 1; and so on.
*
* @see getId()
*/
public static final long BASE_ID = -100;
/**
* _level0 == LEVEL_ID, _level1 == LEVEL_ID-1, ...
*
* all IDs below this line are dynamic.
*/
public static final long LEVEL_ID = -300;
/**
* The return value of getTypeName() if this value represents the traits of a class.
*/
public static final String TRAITS_TYPE_NAME = "traits"; //$NON-NLS-1$
/**
* Variable type can be one of VariableType.OBJECT,
* VariableType.FUNCTION, VariableType.NUMBER, VariableType.STRING,
* VariableType.UNDEFINED, VariableType.NULL.
*/
public int getType();
/**
* The type name of the value:
*
*
* -
"Number"
* -
"Boolean"
* -
"String"
* -
"null"
* -
"undefined"
* -
Value.TRAITS_TYPE_NAME if this value represents the
* traits of a class
* -
"[package::]Classname@hexaddr" if this value
* represents an instance of a non-primitive object. For example, if this is
* an instance of mx.core.Application, the type name might be
* "mx.core::Application@1234abcd".
*
*/
public String getTypeName();
/**
* The class name of the value. This isn't actually very useful, and should
* probably go away; it had more relevant in ActionScript 2, when the return
* value from this function could have been any one of the strings returned
* by {@link DVariable#classNameFor(long, boolean)}.
*
* In the AS3 world, the only possible return values from this function are:
*
*
* -
"Object" for instances of non-primitive classes such
* as Object, Array, etc.
* -
"" all primitive values (Number, Boolean, String,
* null, undefined), or the traits of a class.
*
*/
public String getClassName();
/**
* Variable attributes define further information
* regarding the variable. They are bitfields identified
* as VariableAttribute.xxx
*
* @see VariableAttribute
*/
public int getAttributes();
/**
* @see VariableAttribute
*/
public boolean isAttributeSet(int variableAttribute);
/**
* Returns a unique ID for the object referred to by this variable.
* If two variables point to the same underlying object, their
* getId() functions will return the same value.
*
* This is only meaningful for variables that store an Object or
* MovieClip. For other types of variables (e.g. integers and
* strings), this returns UNKNOWN_ID.
*/
public long getId();
/**
* Returns the value of the variable, as an Object. The return
* value will always be one of the following:
*
*
* -
null
* -
Value.UNDEFINED
* - a
Boolean
* - a
Double (careful, it might be Double.NaN)
* - a
String
* - a
Long if this value represents a non-primitive
* type, such as an Object. If it is a Long, then it is the id of
* the Value (the same value returned by getId()).
*
*/
public Object getValueAsObject();
/**
* Returns the value of the variable, converted to a string. Strings
* are returned as the exact value of the string itself, with no
* extra quotation marks and no escaping of characters within the
* string.
*/
public String getValueAsString();
/**
* Returns all child members of this variable. Can only be called for
* variables of type Object or MovieClip.
* @throws NotConnectedException
* @throws NoResponseException
* @throws NotSuspendedException
*/
public Variable[] getMembers(Session s) throws NotSuspendedException, NoResponseException, NotConnectedException;
/**
* Returns a specific child member of this variable. Can only be called for
* variables of type Object or MovieClip.
* @param s the session
* @param name just a varname name, without its namespace (see getName())
* @return the specified child member, or null if there is no such child.
* @throws NotConnectedException
* @throws NoResponseException
* @throws NotSuspendedException
*/
public Variable getMemberNamed(Session s, String name) throws NotSuspendedException, NoResponseException, NotConnectedException;
/**
* Returns the number of child members of this variable. If called for
* a variable which has a simple type such as integer or string,
* returns zero.
* @throws NotConnectedException
* @throws NoResponseException
* @throws NotSuspendedException
*/
public int getMemberCount(Session s) throws NotSuspendedException, NoResponseException, NotConnectedException;
/**
* Returns the list of classes that contributed members to this object, from
* the class itself all the way down to Object (or, if
* allLevels == false, down to the lowest-level class that actually
* contributed members).
*
* @param allLevels
* if true, the caller wants the entire class
* hierarchy. If false, the caller wants only
* that portion of the class hierarchy that actually contributed
* member variables to the object. For example,
* Object has no members, so if the caller passes
* true then the returned array of strings will
* always end with Object, but if the caller
* passes false then the returned array of strings
* will never end with Object.
* @return an array of fully qualified class names.
*/
public String[] getClassHierarchy(boolean allLevels);
/**
* Returns all child members of this variable that are private and are present
* in its inheritance chain. Only relevant after a call to getMembers().
*
* Warning: This may contain variables with the same name (when there is more
* than two level inheritance).
*/
public Variable[] getPrivateInheritedMembers();
/**
* Get all the private variables with the given name. Usually one, but more
* may be present if the inheritance chain is long.
* @param name Variable name.
*/
public Variable[] getPrivateInheritedMemberNamed(String name);
/**
* Get the worker id of the isolate to which this value belongs.
*/
public int getIsolateId();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy