Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2006 Google Inc.
*
* Licensed 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 java.lang;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.TypeVariable;
import java.security.ProtectionDomain;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.reflect.shared.AnnotationMap;
import com.google.gwt.reflect.shared.ClassMap;
import com.google.gwt.reflect.shared.JsMemberPool;
import com.google.gwt.reflect.shared.ReflectUtil;
/**
* Generally unsupported. This class is provided so that the GWT compiler can
* choke down class literal references.
*
* @param the type of the object
*/
@SuppressWarnings("serial")
public final class Class
implements java.io.Serializable,
java.lang.reflect.GenericDeclaration,
java.lang.reflect.Type,
java.lang.reflect.AnnotatedElement
{
private static final int PRIMITIVE = 0x00000001;
private static final int INTERFACE = 0x00000002;
private static final int ARRAY = 0x00000004;
private static final int ENUM = 0x00000008;
private static final String NOT_IMPLEMENTED_CORRECTLY = "You cannot call this method in gwt from a normal class" +
" object. You must wrap your class literal with GwtReflect.magicClass(MyClass.class) first.";
private static final String NOT_FOUND = "Did you forget to annotate with @ReflectionStrategy methods, " +
"or to call GwtReflect.magicClass on your class literal?.";
private static int index;
private static final JavaScriptObject CONSTS;
static {
if (GWT.isClient()) {
CONSTS = initConstPool();
}
else {
CONSTS = null;
}
}
private static native JavaScriptObject initConstPool()
/*-{
$wnd.Reflect = {
$:[],// enhanced classes
$$:[],// class members
a:[],// annotations
c:[],// classes
d:[],// doubles (includes float)
e:[],// enums
i:[],// ints (includes short, char, byte)
l:[],// longs
n:{},// class by name
s:[],// strings
p:{},// packages
_a:[],// annotation arrays
_b:[],// byte arrays
_c:[],// char arrays
_d:[],// double arrays
_e:[],// enum arrays
_f:[],// float arrays
_i:[],// int arrays
_j:[],// long arrays
_l:[],// Class (type) arrays
_o:[],// Object arrays
_s:[],// short arrays
_t:[],// String arrays
_z:[]// boolan arrays
};
return $wnd.Reflect;
}-*/;
static native String asString(int number) /*-{
// for primitives, the seedId isn't a number, but a string like ' Z'
return typeof(number) == 'number' ? "S" + (number < 0 ? -number : number) : number;
}-*/;
/**
* Create a Class object for an array.
*
* @skip
*/
static Class createForArray(String packageName, String className,
int seedId, Class> componentType) {
// Initialize here to avoid method inliner
Class clazz = new Class();
setName(clazz, packageName, className, seedId != 0 ? -seedId : 0);
clazz.modifiers = ARRAY;
clazz.superclass = Object.class;
clazz.componentType = componentType;
return clazz;
}
/**
* Create a Class object for a class.
*
* @skip
*/
static Class createForClass(String packageName, String className,
int seedId, Class super T> superclass) {
// Initialize here to avoid method inliner
Class clazz = new Class();
setName(clazz, packageName, className, seedId);
clazz.superclass = superclass;
return clazz;
}
/**
* Create a Class object for an enum.
*
* @skip
*/
static Class createForEnum(String packageName, String className,
int seedId, Class super T> superclass,
JavaScriptObject enumConstantsFunc, JavaScriptObject enumValueOfFunc) {
// Initialize here to avoid method inliner
Class clazz = new Class();
setName(clazz, packageName, className, seedId);
clazz.modifiers = (enumConstantsFunc != null) ? ENUM : 0;
clazz.superclass = clazz.enumSuperclass = superclass;
clazz.enumConstantsFunc = enumConstantsFunc;
clazz.enumValueOfFunc = enumValueOfFunc;
return clazz;
}
/**
* Create a Class object for an interface.
*
* @skip
*/
static Class createForInterface(String packageName, String className) {
// Initialize here to avoid method inliner
Class clazz = new Class();
setName(clazz, packageName, className, 0);
clazz.modifiers = INTERFACE;
return clazz;
}
/**
* Create a Class object for a primitive.
*
* @skip
*/
static Class> createForPrimitive(String packageName, String className,
int seedId) {
// Initialize here to avoid method inliner
Class> clazz = new Class