当前位置: 首页>>代码示例>>Java>>正文


Java ReflectionException.printStackTrace方法代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.reflect.ReflectionException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java ReflectionException.printStackTrace方法的具体用法?Java ReflectionException.printStackTrace怎么用?Java ReflectionException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.utils.reflect.ReflectionException的用法示例。


在下文中一共展示了ReflectionException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PlatformDistributor

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
/**
 * Creates platform specific object by reflection.
 * <p>
 * Uses class names given by {@link #getAndroidClassName()} and {@link #getIOSClassName()}
 * <p>
 * If you need to run project on different platform use {@link #setMockObject(Object)} to polyfill platform object.
 *
 * @throws PlatformDistributorException Throws when something is wrong with environment
 */
@SuppressWarnings("unchecked")
protected PlatformDistributor() throws PlatformDistributorException
{
    String className = null;
    if (Gdx.app.getType() == Application.ApplicationType.Android) {
        className = getAndroidClassName();
    } else if (Gdx.app.getType() == Application.ApplicationType.iOS) {
        className = getIOSClassName();
    } else if (Gdx.app.getType() == Application.ApplicationType.WebGL) {
        className = getWebGLClassName();
    } else {
        return;
    }
    try {
        Class objClass = ClassReflection.forName(className);
        platformObject = (T) ClassReflection.getConstructor(objClass).newInstance();
    } catch (ReflectionException e) {
        e.printStackTrace();
        throw new PlatformDistributorException("Something wrong with environment");
    }
}
 
开发者ID:mk-5,项目名称:gdx-fireapp,代码行数:31,代码来源:PlatformDistributor.java

示例2: invoke

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
public void invoke(JGameObject clickTarget) {
	for (Component component : clickTarget.getAllComponents()) {
		if (component.getClass().getName().equals(invokeComponent)) {
			Object[] parameters = args.toArray(new Object[args.size()]);
			Class[] parametersType = new Class[args.size()];
			for (int x = 0; x < parameters.length; x++) {
				parametersType[x] = parameters[x].getClass();
			}

			try {
				Method method = ClassReflection.getDeclaredMethod(component.getClass(), invokeMethod,
						parametersType);
				method.invoke(component, parameters);
			} catch (ReflectionException e) {
				e.printStackTrace();
			}
		}
	}
}
 
开发者ID:Radomiej,项目名称:JavityEngine,代码行数:20,代码来源:RemoteInvoker.java

示例3: androidIsLoadedWithActivityMode

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
@Test
@SuppressWarnings("static-access")
public void androidIsLoadedWithActivityMode() {
	androidSetup();

	try {
		Mockito.when(constructorMock.newInstance(Gdx.app, config)).thenReturn(twitterAPIStub);

	} catch (ReflectionException e) {
		e.printStackTrace();
	}

	Mockito.when(classReflectionMock.isAssignableFrom(activityStub.getClass(), Gdx.app.getClass())).thenReturn(true);

	fixture = new TwitterSystem(config);
	assertEquals(twitterAPIStub, fixture.getTwitterAPI());
}
 
开发者ID:TomGrill,项目名称:gdx-twitter,代码行数:18,代码来源:TwitterSystemUnitTests.java

示例4: tryLoadDesktopTwitterAPI

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
private void tryLoadDesktopTwitterAPI() {
	if (Gdx.app.getType() != ApplicationType.Desktop) {
		Gdx.app.debug(TAG, "Skip loading Twitter API for Desktop. Not running Desktop. \n");
		return;
	}
	try {

		final Class<?> twitterClazz = ClassReflection.forName("de.tomgrill.gdxtwitter.desktop.DesktopTwitterAPI");
		Object twitter = ClassReflection.getConstructor(twitterClazz, TwitterConfig.class).newInstance(config);

		twitterAPI = (TwitterAPI) twitter;

		Gdx.app.debug(TAG, "gdx-twitter for Desktop loaded successfully.");

	} catch (ReflectionException e) {
		Gdx.app.debug(TAG, "Error creating gdx-twitter for Desktop (are the gdx-twitter **.jar files installed?). \n");
		e.printStackTrace();
	}

}
 
开发者ID:TomGrill,项目名称:gdx-twitter,代码行数:21,代码来源:TwitterSystem.java

示例5: tryLoadHTMLTwitterAPI

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
private void tryLoadHTMLTwitterAPI() {
	if (Gdx.app.getType() != ApplicationType.WebGL) {
		Gdx.app.debug(TAG, "Skip loading gdx-twitter for HTML. Not running HTML. \n");
		return;
	}

	try {

		final Class<?> twitterClazz = ClassReflection.forName("de.tomgrill.gdxtwitter.html.HTMLTwitterAPI");
		Object twitter = ClassReflection.getConstructor(twitterClazz, TwitterConfig.class).newInstance(config);

		twitterAPI = (TwitterAPI) twitter;

		Gdx.app.debug(TAG, "gdx-twitter for HTML loaded successfully.");

	} catch (ReflectionException e) {
		Gdx.app.debug(TAG, "Error creating gdx-twitter for HTML (are the gdx-twitter **.jar files installed?). \n");
		e.printStackTrace();
	}

}
 
开发者ID:TomGrill,项目名称:gdx-twitter,代码行数:22,代码来源:TwitterSystem.java

示例6: tryLoadIOSTWitterAPI

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
private void tryLoadIOSTWitterAPI() {

		if (Gdx.app.getType() != ApplicationType.iOS) {
			Gdx.app.debug(TAG, "Skip loading gdx-twitter for iOS. Not running iOS. \n");
			return;
		}
		try {

			// Class<?> activityClazz =
			// ClassReflection.forName("com.badlogic.gdx.backends.iosrobovm.IOSApplication");
			final Class<?> twitterClazz = ClassReflection.forName("de.tomgrill.gdxtwitter.ios.IOSTwitterAPI");

			Object twitter = ClassReflection.getConstructor(twitterClazz, TwitterConfig.class).newInstance(config);

			twitterAPI = (TwitterAPI) twitter;

			Gdx.app.debug(TAG, "gdx-twitter for iOS loaded successfully.");

		} catch (ReflectionException e) {
			Gdx.app.debug(TAG, "Error creating gdx-twitter for iOS (are the gdx-twitter **.jar files installed?). \n");
			e.printStackTrace();
		}

	}
 
开发者ID:TomGrill,项目名称:gdx-twitter,代码行数:25,代码来源:TwitterSystem.java

示例7: returnAndroidGDXFacebookWhenOnAndroid_core_support_v4_app_Fragment

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
@Test
public void returnAndroidGDXFacebookWhenOnAndroid_core_support_v4_app_Fragment() {

    androidPremocking();

    when(ClassReflection.isAssignableFrom(Activity.class, mockObject.getClass())).thenReturn(false);

    try {
        when(ClassReflection.forName("android.support.v4.app.Fragment")).thenReturn(Fragment.class);
        when(ClassReflection.isAssignableFrom(Fragment.class, mockObject.getClass())).thenReturn(true);
        when(ClassReflection.getMethod(Fragment.class, "getActivity")).thenReturn(mockMethod);
        when(mockMethod.invoke(mockObject)).thenReturn(mockFacebook);

    } catch (ReflectionException e) {
        e.printStackTrace();
    }

    androidPostmocking();

    facebook = GDXFacebookSystem.install(new GDXFacebookConfig());
    assertTrue(facebook instanceof AndroidGDXFacebook);
}
 
开发者ID:TomGrill,项目名称:gdx-facebook,代码行数:23,代码来源:GDXFacebookLoaderUnitTests.java

示例8: returnAndroidGDXFacebookWhenOnAndroid_core_app_Fragment

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
@Test
public void returnAndroidGDXFacebookWhenOnAndroid_core_app_Fragment() {

    androidPremocking();

    when(ClassReflection.isAssignableFrom(Activity.class, mockObject.getClass())).thenReturn(false);

    try {
        when(ClassReflection.forName("android.support.v4.app.Fragment")).thenReturn(null);
        when(ClassReflection.forName("android.app.Fragment")).thenReturn(android.app.Fragment.class);

        when(ClassReflection.isAssignableFrom(android.app.Fragment.class, mockObject.getClass())).thenReturn(true);
        when(ClassReflection.getMethod(android.app.Fragment.class, "getActivity")).thenReturn(mockMethod);
        when(mockMethod.invoke(mockObject)).thenReturn(mockFacebook);

    } catch (ReflectionException e) {
        e.printStackTrace();
    }

    androidPostmocking();

    facebook = GDXFacebookSystem.install(new GDXFacebookConfig());
    assertTrue(facebook instanceof AndroidGDXFacebook);
}
 
开发者ID:TomGrill,项目名称:gdx-facebook,代码行数:25,代码来源:GDXFacebookLoaderUnitTests.java

示例9: returnIOSGDXFacebookWhenOnIOS

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
@Test
public void returnIOSGDXFacebookWhenOnIOS() {
    Application mockApplication = mock(Application.class);
    when(mockApplication.getType()).thenReturn(Application.ApplicationType.iOS);
    Gdx.app = mockApplication;

    try {
        Constructor mockConstructor = PowerMockito.mock(Constructor.class);
        GDXFacebook mockFacebook = mock(IOSGDXFacebook.class);

        when(ClassReflection.forName(GDXFacebookVars.CLASSNAME_IOS)).thenReturn(IOSGDXFacebook.class);
        when(ClassReflection.getConstructor(IOSGDXFacebook.class, GDXFacebookConfig.class)).thenReturn(mockConstructor);
        when(mockConstructor.newInstance(anyObject())).thenReturn(mockFacebook);

    } catch (ReflectionException e) {
        e.printStackTrace();
    }

    facebook = GDXFacebookSystem.install(new GDXFacebookConfig());
    assertTrue(facebook instanceof IOSGDXFacebook);
}
 
开发者ID:TomGrill,项目名称:gdx-facebook,代码行数:22,代码来源:GDXFacebookLoaderUnitTests.java

示例10: returnDesktopGDXFacebookWhenOnDesktop

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
@Test
public void returnDesktopGDXFacebookWhenOnDesktop() {
    Application mockApplication = mock(Application.class);
    when(mockApplication.getType()).thenReturn(Application.ApplicationType.Desktop);
    Gdx.app = mockApplication;

    try {
        Constructor mockConstructor = PowerMockito.mock(Constructor.class);
        GDXFacebook mockFacebook = mock(DesktopGDXFacebook.class);

        when(ClassReflection.forName(GDXFacebookVars.CLASSNAME_DESKTOP)).thenReturn(DesktopGDXFacebook.class);
        when(ClassReflection.getConstructor(DesktopGDXFacebook.class, GDXFacebookConfig.class)).thenReturn(mockConstructor);
        when(mockConstructor.newInstance(anyObject())).thenReturn(mockFacebook);

    } catch (ReflectionException e) {
        e.printStackTrace();
    }

    facebook = GDXFacebookSystem.install(new GDXFacebookConfig());
    assertTrue(facebook instanceof DesktopGDXFacebook);
}
 
开发者ID:TomGrill,项目名称:gdx-facebook,代码行数:22,代码来源:GDXFacebookLoaderUnitTests.java

示例11: returnHTMLGDXFacebookWhenOnWebGL

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
@Test
public void returnHTMLGDXFacebookWhenOnWebGL() {
    Application mockApplication = mock(Application.class);
    when(mockApplication.getType()).thenReturn(Application.ApplicationType.WebGL);
    Gdx.app = mockApplication;

    try {
        Constructor mockConstructor = PowerMockito.mock(Constructor.class);
        GDXFacebook mockFacebook = mock(HTMLGDXFacebook.class);

        when(ClassReflection.forName(GDXFacebookVars.CLASSNAME_HTML)).thenReturn(HTMLGDXFacebook.class);
        when(ClassReflection.getConstructor(HTMLGDXFacebook.class, GDXFacebookConfig.class)).thenReturn(mockConstructor);
        when(mockConstructor.newInstance(anyObject())).thenReturn(mockFacebook);

    } catch (ReflectionException e) {
        e.printStackTrace();
    }

    facebook = GDXFacebookSystem.install(new GDXFacebookConfig());
    assertTrue(facebook instanceof HTMLGDXFacebook);
}
 
开发者ID:TomGrill,项目名称:gdx-facebook,代码行数:22,代码来源:GDXFacebookLoaderUnitTests.java

示例12: processClassName

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
private static void processClassName(final Iterable<Class<? extends Annotation>> annotations,
        final Array<Class<?>> result, final String packageName, final String className) {
    if (!className.startsWith(packageName)) {
        return;
    }
    try {
        final Class<?> classToProcess = ClassReflection.forName(className);
        for (final Class<? extends Annotation> annotation : annotations) {
            if (ClassReflection.isAnnotationPresent(classToProcess, annotation)) {
                result.add(classToProcess);
                return;
            }
        }
    } catch (final ReflectionException exception) {
        exception.printStackTrace(); // Unexpected. Classes should be present.
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:18,代码来源:AndroidClassScanner.java

示例13: load

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
public static AbstractDurationStyle load(Element xml)
{		
	Class<AbstractDurationStyle> c = ClassMap.get(xml.getName().toUpperCase());
	AbstractDurationStyle type = null;
	
	try
	{
		type = (AbstractDurationStyle)ClassReflection.newInstance(c);
	} 
	catch (ReflectionException e)
	{
		e.printStackTrace();
	}
	
	type.parse(xml);
	
	return type;
}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:19,代码来源:AbstractDurationStyle.java

示例14: load

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
public static AbstractTownEvent load(XmlReader.Element xml )
{
	Class<AbstractTownEvent> c = ClassMap.get(xml.getName().toUpperCase());
	AbstractTownEvent type = null;

	try
	{
		type = (AbstractTownEvent) ClassReflection.newInstance( c );
	}
	catch (ReflectionException e)
	{
		e.printStackTrace();
	}

	type.parse(xml);

	return type;
}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:19,代码来源:AbstractTownEvent.java

示例15: load

import com.badlogic.gdx.utils.reflect.ReflectionException; //导入方法依赖的package包/类
public static AbstractHitType load(XmlReader.Element xml )
{
	Class<AbstractHitType> c = ClassMap.get(xml.getName().toUpperCase());
	AbstractHitType type = null;

	try
	{
		type = (AbstractHitType) ClassReflection.newInstance( c );
	}
	catch (ReflectionException e)
	{
		e.printStackTrace();
	}

	type.parse(xml);

	return type;
}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:19,代码来源:AbstractHitType.java


注:本文中的com.badlogic.gdx.utils.reflect.ReflectionException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。