Java 类com.badlogic.gdx.utils.reflect.ClassReflection 实例源码

项目:Mindustry    文件:ByteSerializer.java   
@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);
    }
}
项目:Mindustry    文件:SaveDialog.java   
void save(SaveSlot slot){

        Vars.ui.loadfrag.show("$text.saveload");

        Timers.runTask(5f, () -> {
            hide();
            Vars.ui.loadfrag.hide();
            try{
                slot.save();
            }catch(Throwable e){
                e = (e.getCause() == null ? e : e.getCause());

                Vars.ui.showError("[orange]"+Bundles.get("text.savefail")+"\n[white]" + ClassReflection.getSimpleName(e.getClass()) + ": " + e.getMessage() + "\n" + "at " + e.getStackTrace()[0].getFileName() + ":" + e.getStackTrace()[0].getLineNumber());
            }
        });
    }
项目:Mindustry    文件:PausedDialog.java   
private void runExitSave(){
    if(Vars.control.getSaves().getCurrent() == null ||
            !Vars.control.getSaves().getCurrent().isAutosave()){
        GameState.set(State.menu);
        Vars.control.getTutorial().reset();
        return;
    }

    Vars.ui.loadfrag.show("$text.saveload");

    Timers.runTask(5f, () -> {
        Vars.ui.loadfrag.hide();
        try{
            Vars.control.getSaves().getCurrent().save();
        }catch(Throwable e){
            e = (e.getCause() == null ? e : e.getCause());
            Vars.ui.showError("[orange]"+ Bundles.get("text.savefail")+"\n[white]" + ClassReflection.getSimpleName(e.getClass()) + ": " + e.getMessage() + "\n" + "at " + e.getStackTrace()[0].getFileName() + ":" + e.getStackTrace()[0].getLineNumber());
        }
        GameState.set(State.menu);
    });
}
项目:gdx-cclibs    文件:JsonFieldUpdater.java   
/**
 * Returns the Class matching the name of the JsonValue, or null if there is no match or it's nameless.
 */
private Class getClass(JsonValue value, ObjectMap<String, Class> tagsToClasses) {
    if (value.name() != null && value.name().length() > 0) {
        String className = value.name();
        Class type = tagsToClasses.get(className);
        if (type == null) {
            try {
                type = ClassReflection.forName(className);
            } catch (ReflectionException ex) {
                type = null;
            }
        }
        return type;
    }
    return null;
}
项目:gdx-cclibs    文件:JsonFieldUpdater.java   
private OrderedMap<String, Field> getStaticFields(Class type) {
    if (staticFields.containsKey(type))
        return staticFields.get(type);
    Field[] fields = ClassReflection.getDeclaredFields(type);
    OrderedMap<String, Field> nameToField = new OrderedMap(fields.length);
    for (Field field : fields) {
        if (!field.isStatic())
            continue;
        if (!field.isAccessible()) {
            try {
                field.setAccessible(true);
            } catch (AccessControlException ex) {
                continue;
            }
        }

        nameToField.put(field.getName(), field);
    }
    staticFields.put(type, nameToField);
    return nameToField;
}
项目:gdx-fireapp    文件:AnnotationProcessor.java   
/**
 * Gets {@code NestedGenericType} annotation from object.
 * <p>
 * Looks at all object methods and returns first encountered annotation.
 *
 * @param object Object to deal with, not null
 * @return Annotation, may be null
 */
public static NestedGenericType getNestedGenericTypeAnnotation(Object object)
{
    NestedGenericType result = null;
    Method[] methods = ClassReflection.getMethods(object.getClass());
    // TODO - use type annotation, not method?
    for (Method m : methods) {
        Annotation[] annotations = m.getDeclaredAnnotations();
        Annotation a = m.getDeclaredAnnotation(NestedGenericType.class);
        if (a != null) {
            result = a.getAnnotation(NestedGenericType.class);
            break;
        }
    }
    return result;
}
项目:gdx-fireapp    文件:JsonProcessor.java   
/**
 * Converts json string into java object.
 *
 * @param wantedType        Wanted type
 * @param genericTypeKeeper Object with wanted type inside generic argument
 * @param jsonString        Json string data
 * @param <R>               Return type
 * @return
 */
public static <R> R process(Class<?> wantedType, Object genericTypeKeeper, String jsonString)
{
    Json json = new Json();
    json.setIgnoreUnknownFields(true);
    json.setTypeName(null);
    R result = null;
    if (ClassReflection.isAssignableFrom(List.class, wantedType)
            || ClassReflection.isAssignableFrom(Map.class, wantedType)) {
        NestedGenericType nestedGenericType = AnnotationProcessor.getNestedGenericTypeAnnotation(genericTypeKeeper);
        if (nestedGenericType == null) throw new NestedGenericTypeAnnotationMissingException();
        json.setDefaultSerializer(new JsonListMapDeserializer(wantedType, nestedGenericType.value()));
        result = (R) json.fromJson(wantedType, jsonString);
    } else {
        result = (R) json.fromJson(wantedType, jsonString);
    }
    return result;
}
项目:gdx-fireapp    文件:PlatformDistributor.java   
/**
 * 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");
    }
}
项目:PixelDungeonTC    文件:Bundle.java   
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;
    }   
}
项目:JavityEngine    文件:RemoteInvoker.java   
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();
            }
        }
    }
}
项目:skin-composer    文件:StyleProperty.java   
@Override
public void read(Json json, JsonValue jsonValue) {
    try {
        name = jsonValue.getString("name");
        optional = jsonValue.getBoolean("optional");
        if (jsonValue.get("value").isNumber()) {
            type = Float.TYPE;
            value = Double.parseDouble(jsonValue.getString("value"));
        } else {
            type = ClassReflection.forName(jsonValue.getString("type"));
            if (jsonValue.get("value").isNull()) {
                value = null;
            } else {
                value = jsonValue.getString("value");
            }
        }
    } catch (ReflectionException ex) {
        Gdx.app.error(getClass().toString(), "Error reading from serialized object" , ex);
        DialogFactory.showDialogErrorStatic("Read Error...","Error reading from serialized object.\n\nOpen log?");
    }
}
项目:skin-composer    文件:JsonData.java   
@Override
public void read(Json json, JsonValue jsonData) {
    try {
        colors = json.readValue("colors", Array.class, jsonData);
        fonts = json.readValue("fonts", Array.class, jsonData);
        classStyleMap = new OrderedMap<>();
        for (JsonValue data : jsonData.get("classStyleMap").iterator()) {
            classStyleMap.put(ClassReflection.forName(data.name), json.readValue(Array.class, data));
        }
        for (Array<StyleData> styleDatas : classStyleMap.values()) {
            for (StyleData styleData : styleDatas) {
                styleData.jsonData = this;
            }
        }
        customClasses = json.readValue("customClasses", Array.class, CustomClass.class, new Array<>(), jsonData);
        for (CustomClass customClass : customClasses) {
            customClass.setMain(main);
        }
    } catch (ReflectionException e) {
        Gdx.app.log(getClass().getName(), "Error parsing json data during file read", e);
        main.getDialogFactory().showDialogError("Error while reading file...", "Error while attempting to read save file.\nPlease ensure that file is not corrupted.\n\nOpen error log?");
    }
}
项目:Inspiration    文件:MessageDispatcher.java   
/** Registers a listener for the specified message code. Messages without an explicit receiver are broadcasted to all its
 * registered listeners.
 * @param listener the listener to add
 * @param msg the message code */
public void addListener (Telegraph listener, int msg) {
    Array<Telegraph> listeners = msgListeners.get(msg);
    if (listeners == null) {
        // Associate an empty unordered array with the message code
        listeners = new Array<Telegraph>(false, 16);
        msgListeners.put(msg, listeners);
    }
    listeners.add(listener);

    // Dispatch messages from registered providers
    Array<TelegramProvider> providers = msgProviders.get(msg);
    if (providers != null) {
        for (int i = 0, n = providers.size; i < n; i++) {
            TelegramProvider provider = providers.get(i);
            Object info = provider.provideMessageInfo(msg, listener);
            if (info != null) {
                Telegraph sender = ClassReflection.isInstance(Telegraph.class, provider) ? (Telegraph)provider : null;
                dispatchMessage(0, sender, listener, msg, info, false);
            }
        }
    }
}
项目:Inspiration    文件:Task.java   
/** Clones this task to a new one. If you don't specify a clone strategy through {@link #TASK_CLONER} the new task is
 * instantiated via reflection and {@link #copyTo(Task)} is invoked.
 * @return the cloned task
 * @throws TaskCloneException if the task cannot be successfully cloned. */
@SuppressWarnings("unchecked")
public Task<E> cloneTask () {
    if (TASK_CLONER != null) {
        try {
            return TASK_CLONER.cloneTask(this);
        } catch (Throwable t) {
            throw new TaskCloneException(t);
        }
    }
    try {
        Task<E> clone = copyTo(ClassReflection.newInstance(this.getClass()));
        clone.guard = guard == null ? null : guard.cloneTask();
        return clone;
    } catch (ReflectionException e) {
        throw new TaskCloneException(e);
    }
}
项目:Inspiration    文件:BehaviorTreeParser.java   
private Metadata findMetadata (Class<?> clazz) {
    Metadata metadata = metadataCache.get(clazz);
    if (metadata == null) {
        Annotation tca = ClassReflection.getAnnotation(clazz, TaskConstraint.class);
        if (tca != null) {
            TaskConstraint taskConstraint = tca.getAnnotation(TaskConstraint.class);
            ObjectMap<String, AttrInfo> taskAttributes = new ObjectMap<String, AttrInfo>();
            Field[] fields = ClassReflection.getFields(clazz);
            for (Field f : fields) {
                Annotation a = f.getDeclaredAnnotation(TaskAttribute.class);
                if (a != null) {
                    AttrInfo ai = new AttrInfo(f.getName(), a.getAnnotation(TaskAttribute.class));
                    taskAttributes.put(ai.name, ai);
                }
            }
            metadata = new Metadata(taskConstraint.minChildren(), taskConstraint.maxChildren(), taskAttributes);
            metadataCache.put(clazz, metadata);
        }
    }
    return metadata;
}
项目:fabulae    文件:XMLUtil.java   
/**
 * Read the actions from the suppled XML element and loads them into the
 * supplied ActionsContainer.
 * 
 * The XML element should contain children in the following format:
 * 
 * <pre>
 * &lt;actionClassName parameter1Name="parameter1Value" parameter2Name="parameter2Value" ... /&gt;
 * </pre>
 * 
 * @param ac
 * @param actionsElement
 */
@SuppressWarnings({ "unchecked" })
public static void readActions(ActionsContainer ac, Element actionsElement) {
    if (actionsElement != null) {
        for (int i = 0; i < actionsElement.getChildCount(); ++i) {
            Element actionElement = actionsElement.getChild(i);
            String implementationClassName = actionElement.getName();
            implementationClassName = Action.class.getPackage().getName() + "."
                    + StringUtil.capitalizeFirstLetter(implementationClassName);
            try {
                Class<? extends Action> actionClass = (Class<? extends Action>) ClassReflection
                        .forName(implementationClassName);
                Action newAction = ac.addAction(actionClass);
                if (newAction != null) {
                    newAction.loadFromXML(actionElement);
                }

            } catch (ReflectionException e) {
                throw new GdxRuntimeException(e);
            }
        }
    }
}
项目:RavTech    文件:Spriter.java   
/** Loads the given SCML stream pointing to a file saved at the given path.
 * 
 * @param stream the SCML stream
 * @param scmlFile the path to the SCML file */
public static void load (InputStream stream, String scmlFile) {
    SCMLReader reader = new SCMLReader(stream);
    Data data = reader.data;
    loadedData.put(scmlFile, data);
    loaderDependencies[0] = data;
    try {
        Loader loader = (Loader)ClassReflection.getDeclaredConstructor(loaderClass, loaderTypes).newInstance(loaderDependencies);
        loader.load(RavTech.files.getAssetHandle(scmlFile));
        loaders.add(loader);
        for (Entity entity : data.entities)
            entityToLoader.put(entity, loader);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:gdx-twitter    文件:TwitterSystem.java   
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();
    }

}
项目:gdx-twitter    文件:TwitterSystem.java   
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();
    }

}
项目:gdx-twitter    文件:TwitterSystem.java   
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();
        }

    }
项目:gdx-facebook    文件:GDXFacebookLoaderUnitTests.java   
@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);
}
项目:gdx-facebook    文件:GDXFacebookLoaderUnitTests.java   
@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);
}
项目:gdx-facebook    文件:GDXFacebookLoaderUnitTests.java   
@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);
}
项目:gdx-facebook    文件:GDXFacebookLoaderUnitTests.java   
@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);
}
项目:gdx-facebook    文件:GDXFacebookLoaderUnitTests.java   
@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);
}
项目:Roguelike    文件:AbstractOnDeathEffect.java   
public static AbstractOnDeathEffect load(Element xml)
{
    Class<AbstractOnDeathEffect> c = ClassMap.get(xml.getName().toUpperCase());
    AbstractOnDeathEffect type = null;

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

    type.parse(xml);

    return type;
}
项目:Roguelike    文件:AbstractFieldInteractionType.java   
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;
}
项目:Roguelike    文件:AbstractSpreadStyle.java   
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;
}
项目:Roguelike    文件:AbstractDurationStyle.java   
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;
}
项目:Roguelike    文件:AbstractOnTurnEffect.java   
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;
}
项目:Roguelike    文件:AbstractQuestInput.java   
public static AbstractQuestInput load( XmlReader.Element xml )
{
    Class<AbstractQuestInput> c = ClassMap.get( xml.getName().toUpperCase() );
    AbstractQuestInput type = null;

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

    type.parse( xml );

    return type;
}
项目:Roguelike    文件:AbstractQuestOutputCondition.java   
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;
}
项目:Roguelike    文件:AbstractSpriteAnimation.java   
public static AbstractSpriteAnimation load( Element xml )
{
    Class<AbstractSpriteAnimation> c = ClassMap.get( xml.getName().toUpperCase() );
    AbstractSpriteAnimation type = null;

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

    type.parse( xml );

    return type;
}
项目:Roguelike    文件:AbstractDecorator.java   
@Override
public void parse( Element xmlElement )
{
    Element xml = xmlElement.getChild( 0 );

    try
    {
        Class<BehaviourTreeNode> c = ClassMap.get( xml.getName().toUpperCase() );
        BehaviourTreeNode node = ClassReflection.newInstance( c );

        setNode( node );

        node.parse( xml );
    }
    catch ( Exception e )
    {
        System.err.println(xml.getName());
        e.printStackTrace();
    }
}
项目:Roguelike    文件:AbstractSelector.java   
@Override
public void parse( Element xmlElement )
{
    for ( int i = 0; i < xmlElement.getChildCount(); i++ )
    {
        Element xml = xmlElement.getChild( i );

        try
        {
            Class<BehaviourTreeNode> c = ClassMap.get( xml.getName().toUpperCase() );
            BehaviourTreeNode node = ClassReflection.newInstance( c );

            addNode( node );

            node.parse( xml );
        }
        catch ( Exception e )
        {
            System.err.println(xml.getName());
            e.printStackTrace();
        }
    }
}
项目:Roguelike    文件:AbstractActivationAction.java   
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;
}
项目:Roguelike    文件:AbstractActivationCondition.java   
public static AbstractActivationCondition load( XmlReader.Element xml )
{
    Class<AbstractActivationCondition> c = ClassMap.get( xml.getName().toUpperCase() );
    AbstractActivationCondition type = null;

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

    type.parse( xml );

    return type;
}
项目:Roguelike    文件:AbstractOnDeathEvent.java   
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;
}
项目:Roguelike    文件:AbstractOnHitEvent.java   
public static AbstractOnHitEvent load( XmlReader.Element xml )
{
    Class<AbstractOnHitEvent> c = ClassMap.get( xml.getName().toUpperCase() );
    AbstractOnHitEvent type = null;

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

    type.parse( xml );

    return type;
}
项目:Roguelike    文件:AbstractOnTaskEvent.java   
public static AbstractOnTaskEvent load( Element xml )
{
    Class<AbstractOnTaskEvent> c = ClassMap.get( xml.getName().toUpperCase() );
    AbstractOnTaskEvent type = null;

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

    type.parse( xml );

    return type;
}