alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (Value.java)

This example Java source code file (Value.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

mirror, type, value

The Value.java Java example source code

/*
 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

package com.sun.jdi;

/**
 * The mirror for a value in the target VM.
 * This interface is the root of a
 * value hierarchy encompassing primitive values and object values.
 * <P>
 * Some examples of where values may be accessed:
 * <BLOCKQUOTE>
 * <TR>
 *   <TD>{@link ObjectReference#getValue(com.sun.jdi.Field)
 *                 ObjectReference.getValue(Field)}
 *   <TD>- value of a field
 * <TR>
 *   <TD>{@link StackFrame#getValue(com.sun.jdi.LocalVariable)
 *                 StackFrame.getValue(LocalVariable)}
 *   <TD>- value of a variable
 * <TR>
 *   <TD>{@link VirtualMachine#mirrorOf(double)
 *                 VirtualMachine.mirrorOf(double)}
 *   <TD>- created in the target VM by the JDI client
 * <TR>
 *   <TD>{@link com.sun.jdi.event.ModificationWatchpointEvent#valueToBe()
 *                 ModificationWatchpointEvent.valueToBe()}
 *   <TD>- returned with an event
 * </TABLE>
 * <P>
 * The following table illustrates which subinterfaces of Value
 * are used to mirror values in the target VM --
 * <TABLE BORDER=1 SUMMARY="Maps each kind of value to a mirrored
 *  instance of a subinterface of Value">
 * <TR BGCOLOR="#EEEEFF">
 *   <TH id="primval" colspan=4>Subinterfaces of {@link PrimitiveValue}
 * <TR BGCOLOR="#EEEEFF">
 *   <TH id="kind"     align="left">Kind of value
 *   <TH id="example"  align="left">For example -
expression in target * <TH id="mirrored" align="left">Is mirrored as an
instance of * <TH id="type" align="left">{@link Type} of value
{@link #type() Value.type()} * <TR> * <TD headers="primval kind"> a boolean * <TD headers="primval example"> true * <TD headers="primval mirrored"> {@link BooleanValue} * <TD headers="primval type"> {@link BooleanType} * <TR> * <TD headers="primval kind"> a byte * <TD headers="primval example"> (byte)4 * <TD headers="primval mirrored"> {@link ByteValue} * <TD headers="primval type"> {@link ByteType} * <TR> * <TD headers="primval kind"> a char * <TD headers="primval example"> 'a' * <TD headers="primval mirrored"> {@link CharValue} * <TD headers="primval type"> {@link CharType} * <TR> * <TD headers="primval kind"> a double * <TD headers="primval example"> 3.1415926 * <TD headers="primval mirrored"> {@link DoubleValue} * <TD headers="primval type"> {@link DoubleType} * <TR> * <TD headers="primval kind"> a float * <TD headers="primval example"> 2.5f * <TD headers="primval mirrored"> {@link FloatValue} * <TD headers="primval type"> {@link FloatType} * <TR> * <TD headers="primval kind"> an int * <TD headers="primval example"> 22 * <TD headers="primval mirrored"> {@link IntegerValue} * <TD headers="primval type"> {@link IntegerType} * <TR> * <TD headers="primval kind"> a long * <TD headers="primval example"> 1024L * <TD headers="primval mirrored"> {@link LongValue} * <TD headers="primval type"> {@link LongType} * <TR> * <TD headers="primval kind"> a short * <TD headers="primval example"> (short)12 * <TD headers="primval mirrored"> {@link ShortValue} * <TD headers="primval type"> {@link ShortType} * <TR> * <TD headers="primval kind"> a void * <TD headers="primval example">   * <TD headers="primval mirrored"> {@link VoidValue} * <TD headers="primval type"> {@link VoidType} * <TR BGCOLOR="#EEEEFF"> * <TH id="objref" colspan=4>Subinterfaces of {@link ObjectReference} * <TR BGCOLOR="#EEEEFF"> * <TH id="kind2" align="left">Kind of value * <TH id="example2" align="left">For example -
expression in target * <TH id="mirrored2" align="left">Is mirrored as an
instance of * <TH id="type2" align="left">{@link Type} of value
{@link #type() Value.type()} * <TR> * <TD headers="objref kind2"> a class instance * <TD headers="objref example2"> this * <TD headers="objref mirrored2"> {@link ObjectReference} * <TD headers="objref type2"> {@link ClassType} * <TR> * <TD headers="objref kind2"> an array * <TD headers="objref example2"> new int[5] * <TD headers="objref mirrored2"> {@link ArrayReference} * <TD headers="objref type2"> {@link ArrayType} * <TR> * <TD headers="objref kind2"> a string * <TD headers="objref example2"> "hello" * <TD headers="objref mirrored2"> {@link StringReference} * <TD headers="objref type2"> {@link ClassType} * <TR> * <TD headers="objref kind2"> a thread * <TD headers="objref example2"> Thread.currentThread() * <TD headers="objref mirrored2"> {@link ThreadReference} * <TD headers="objref type2"> {@link ClassType} * <TR> * <TD headers="objref kind2"> a thread group * <TD headers="objref example2"> Thread.currentThread()
  .getThreadGroup()
* <TD headers="objref mirrored2"> {@link ThreadGroupReference} * <TD headers="objref type2"> {@link ClassType} * <TR> * <TD headers="objref kind2"> a java.lang.Class
instance * <TD headers="objref example2"> this.getClass() * <TD headers="objref mirrored2"> {@link ClassObjectReference} * <TD headers="objref type2"> {@link ClassType} * <TR> * <TD headers="objref kind2"> a class loader * <TD headers="objref example2"> this.getClass()
  .getClassLoader()
* <TD headers="objref mirrored2"> {@link ClassLoaderReference} * <TD headers="objref type2"> {@link ClassType} * <TR BGCOLOR="#EEEEFF"> * <TH id="other" colspan=4>Other * <TR BGCOLOR="#EEEEFF"> * <TH id="kind3" align="left">Kind of value * <TH id="example3" align="left">For example -
expression in target * <TH id="mirrored3" align="left">Is mirrored as * <TH id="type3" align="left">{@link Type} of value * <TR> * <TD headers="other kind3"> null * <TD headers="other example3"> null * <TD headers="other mirrored3"> null * <TD headers="other type3"> n/a * </TABLE> * * @author Robert Field * @author Gordon Hirsch * @author James McIlree * @since 1.3 */ @jdk.Exported public interface Value extends Mirror { /** * Returns the run-time type of this value. * * @see Type * @return a {@link Type} which mirrors the value's type in the * target VM. */ Type type(); }

Other Java examples (source code examples)

Here is a short list of links related to this Java Value.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.