當前位置: 首頁>>代碼示例>>Java>>正文


Java ClassReflection.newInstance方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.utils.reflect.ClassReflection.newInstance方法的典型用法代碼示例。如果您正苦於以下問題:Java ClassReflection.newInstance方法的具體用法?Java ClassReflection.newInstance怎麽用?Java ClassReflection.newInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.utils.reflect.ClassReflection的用法示例。


在下文中一共展示了ClassReflection.newInstance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: read

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的package包/類
@Override
public Object read(ByteBuffer byteBuffer) {
    try {
        byte id = byteBuffer.get();
        if(id == -2){
           return FrameworkSerializer.read(byteBuffer);
        }else {
            Class<?> type = Registrator.getByID(id);
            Packet packet = (Packet) ClassReflection.newInstance(type);
            packet.read(byteBuffer);
            return packet;
        }
    }catch (ReflectionException e){
        throw new RuntimeException(e);
    }
}
 
開發者ID:Anuken,項目名稱:Mindustry,代碼行數:17,代碼來源:ByteSerializer.java

示例2: get

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的package包/類
private Bundlable get() {
	try {
		String clName = getString( CLASS_NAME );
		if (aliases.containsKey( clName )) {
			clName = aliases.get( clName );
		}
		
		Class<?> cl = ClassReflection.forName( clName );
		if (cl != null) {
			Bundlable object = (Bundlable) ClassReflection.newInstance(cl);
			object.restoreFromBundle( this );
			return object;
		} else {
			return null;
		}
	} catch (Exception e) {
		e = null;
		return null;
	}	
}
 
開發者ID:kurtyu,項目名稱:PixelDungeonTC,代碼行數:21,代碼來源:Bundle.java

示例3: load

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的package包/類
public static AbstractDungeonGenerator load( SaveLevel level )
{
	DungeonFileParser dfp = DungeonFileParser.load( level.fileName + "/" + level.fileName );

	Class<AbstractDungeonGenerator> c = ClassMap.get( dfp.generator.toUpperCase() );
	AbstractDungeonGenerator type = null;

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

	type.setup( level, dfp );

	return type;
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:21,代碼來源:AbstractDungeonGenerator.java

示例4: load

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的package包/類
public static AbstractEffectType load( Element xml )
{
	Class<AbstractEffectType> c = ClassMap.get( xml.getName().toUpperCase() );
	AbstractEffectType type = null;

	try
	{
		type = ClassReflection.newInstance( c );
	}
	catch ( Exception e )
	{
		System.err.println(xml.getName());
		e.printStackTrace();
	}

	type.parse( xml );

	return type;
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:20,代碼來源:AbstractEffectType.java

示例5: load

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的package包/類
public static AbstractDialogueAction load( Element xml, DialogueManager manager )
{
	Class<AbstractDialogueAction> c = ClassMap.get( xml.getName().toUpperCase() );
	AbstractDialogueAction type = null;

	try
	{
		type = ClassReflection.newInstance( c );
	}
	catch ( Exception e )
	{
		System.err.println(xml.getName());
		e.printStackTrace();
	}

	type.manager = manager;
	type.parse( xml );

	return type;
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:21,代碼來源:AbstractDialogueAction.java

示例6: load

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的package包/類
public static AbstractMovementType load( Element xml )
{
	Class<AbstractMovementType> c = ClassMap.get( xml.getName().toUpperCase() );
	AbstractMovementType type = null;

	try
	{
		type = ClassReflection.newInstance( c );
	}
	catch ( Exception e )
	{
		System.err.println(xml.getName());
		e.printStackTrace();
	}

	type.parse( xml );

	return type;
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:20,代碼來源:AbstractMovementType.java

示例7: load

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的package包/類
public static AbstractFieldInteractionType load(Element xml)
{
	Class<AbstractFieldInteractionType> c = ClassMap.get(xml.getName().toUpperCase());
	AbstractFieldInteractionType type = null;

	try
	{
		type = (AbstractFieldInteractionType)ClassReflection.newInstance(c);
	}
	catch (Exception e)
	{
		System.err.println(xml.getName());
		e.printStackTrace();
	}

	type.parse(xml);

	return type;
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:20,代碼來源:AbstractFieldInteractionType.java

示例8: load

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的package包/類
public static AbstractSpreadStyle load(Element xml)
{		
	Class<AbstractSpreadStyle> c = ClassMap.get(xml.getName().toUpperCase());
	AbstractSpreadStyle type = null;
	
	try
	{
		type = (AbstractSpreadStyle)ClassReflection.newInstance(c);
	} 
	catch (ReflectionException e)
	{
		e.printStackTrace();
	}
	
	type.parse(xml);
	
	return type;
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:19,代碼來源:AbstractSpreadStyle.java

示例9: load

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的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

示例10: load

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的package包/類
public static AbstractOnTurnEffect load( Element xml )
{
	Class<AbstractOnTurnEffect> c = ClassMap.get( xml.getName().toUpperCase() );
	AbstractOnTurnEffect type = null;

	try
	{
		type = ClassReflection.newInstance( c );
	}
	catch ( Exception e )
	{
		System.err.println(xml.getName());
		e.printStackTrace();
	}

	type.parse( xml );

	return type;
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:20,代碼來源:AbstractOnTurnEffect.java

示例11: load

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的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

示例12: load

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的package包/類
public static AbstractQuestOutputCondition load( XmlReader.Element xml )
{
	Class<AbstractQuestOutputCondition> c = ClassMap.get( xml.getName().toUpperCase() );
	AbstractQuestOutputCondition type = null;

	try
	{
		type = ClassReflection.newInstance( c );
	}
	catch ( Exception e )
	{
		System.err.println(xml.getName());
		e.printStackTrace();
	}

	type.parse( xml );

	return type;
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:20,代碼來源:AbstractQuestOutputCondition.java

示例13: load

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的package包/類
public static AbstractCostType load(Element xml)
{		
	Class<AbstractCostType> c = ClassMap.get(xml.getName().toUpperCase());
	AbstractCostType type = null;
	
	try
	{
		type = (AbstractCostType)ClassReflection.newInstance(c);
	} 
	catch (ReflectionException e)
	{
		e.printStackTrace();
	}
	
	type.parse(xml);
	
	return type;
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:19,代碼來源:AbstractCostType.java

示例14: load

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的package包/類
public static AbstractActivationAction load( XmlReader.Element xml )
{
	Class<AbstractActivationAction> c = ClassMap.get( xml.getName().toUpperCase() );
	AbstractActivationAction type = null;

	try
	{
		type = ClassReflection.newInstance( c );
	}
	catch ( Exception e )
	{
		System.err.println(xml.getName());
		e.printStackTrace();
	}

	type.parse( xml );

	return type;
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:20,代碼來源:AbstractActivationAction.java

示例15: load

import com.badlogic.gdx.utils.reflect.ClassReflection; //導入方法依賴的package包/類
public static AbstractOnDeathEvent load( Element xml )
{
	Class<AbstractOnDeathEvent> c = ClassMap.get( xml.getName().toUpperCase() );
	AbstractOnDeathEvent type = null;

	try
	{
		type = ClassReflection.newInstance( c );
	}
	catch ( Exception e )
	{
		System.err.println(xml.getName());
		e.printStackTrace();
	}

	type.parse( xml );

	return type;
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:20,代碼來源:AbstractOnDeathEvent.java


注:本文中的com.badlogic.gdx.utils.reflect.ClassReflection.newInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。