本文整理匯總了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);
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}