Coverage Report - javafx.reflect.ReflectionContext
 
Classes in this File Line Coverage Branch Coverage Complexity
ReflectionContext
33%
3/9
0%
0/2
0
 
 1  
 /*
 2  
  * Copyright 1999-2008 Sun Microsystems, Inc.  All Rights Reserved.
 3  
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  
  *
 5  
  * This code is free software; you can redistribute it and/or modify it
 6  
  * under the terms of the GNU General Public License version 2 only, as
 7  
  * published by the Free Software Foundation.  Sun designates this
 8  
  * particular file as subject to the "Classpath" exception as provided
 9  
  * by Sun in the LICENSE file that accompanied this code.
 10  
  *
 11  
  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  
  * version 2 for more details (a copy is included in the LICENSE file that
 15  
  * accompanied this code).
 16  
  *
 17  
  * You should have received a copy of the GNU General Public License version
 18  
  * 2 along with this work; if not, write to the Free Software Foundation,
 19  
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  
  *
 21  
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 22  
  * CA 95054 USA or visit www.sun.com if you need additional information or
 23  
  * have any questions.
 24  
  */
 25  
 
 26  
 package javafx.reflect;
 27  
 
 28  
 /** Context for reflective operations.
 29  
  * All the various operations are based on a {@code ReflectionContext}.
 30  
  * This is similar to JDI's {@code VirtualMachine} interface.
 31  
  * In "normal" useage there is a single {@code ReflectionContext} that is
 32  
  * basically a wrapper around {@code java.lang.reflect}, but (for
 33  
  * example) for remote reflection you could have an implementation
 34  
  * based on JDI.
 35  
  * Corresponds to {@code com.sun.jdi.VirtualMachine}.
 36  
  */
 37  
 
 38  
 public abstract class ReflectionContext {
 39  
     /** Find context-dependent default {@code ReflectionContext}.
 40  
      * (For now, this always returns the same {@code LocalReflectionContext}.)
 41  
      */
 42  
     public static ReflectionContext getInstance() {
 43  
         // For now - later might do some more fancy searching.
 44  0
         return LocalReflectionContext.getInstance();
 45  
     }
 46  
 
 47  1
     protected ReflectionContext() {
 48  1
     }
 49  
 
 50  
     public static final String INTERFACE_SUFFIX = "$Intf";
 51  
     public static final String FXOBJECT_NAME =
 52  
             "com.sun.javafx.runtime.FXObject";
 53  
     
 54  
     /** Get the {@code ClassRef} for the class with the given name. */
 55  
     public abstract ClassRef findClass(String name);
 56  1
     TypeRef anyType = findClass("java.lang.Object");
 57  
 
 58  
     /** Get the {@code TypeRef} for the "any" type. */
 59  0
     public TypeRef getAnyType() { return anyType; }
 60  
 
 61  
     /** Get the run-time representation of the JavaXF {@code Integer} type. */
 62  
     public abstract TypeRef getIntegerType();
 63  
 
 64  
     /** Get the run-time representation of the JavaXF {@code Number} type. */
 65  
     public abstract TypeRef getNumberType();
 66  
 
 67  
     /** Create a helper object for building a sequence value. */
 68  
     public abstract SequenceBuilder makeSequenceBuilder (TypeRef elementType);
 69  
 
 70  
     public ValueRef makeSequence(TypeRef elementType, ValueRef... values) {
 71  0
         SequenceBuilder builder = makeSequenceBuilder(elementType);
 72  0
             for (int i = 0; i <= values.length; i++)
 73  0
                 builder.append(values[i]);
 74  0
         return builder.getSequence();
 75  
     }
 76  
 }