Package com.forgeessentials.data.api

Examples of com.forgeessentials.data.api.ClassContainer


        PlayerInfo info = playerInfoMap.get(playerID);
        // load or create one
        if (info == null)
        {
            // Attempt to populate this info with some data from our storage.
            info = (PlayerInfo) DataStorageManager.getReccomendedDriver().loadObject(new ClassContainer(PlayerInfo.class), playerID.toString());
            if (info == null)
            {
                info = new PlayerInfo(playerID);
            }
            playerInfoMap.put(playerID, info);
View Full Code Here


    {
        ITypeInfo info = null;

        if (type.isArray() && !type.getType().getComponentType().isPrimitive() && !String.class.isAssignableFrom(type.getType().getComponentType()))
        {
            info = new TypeInfoArray(new ClassContainer(type.getType()));
        }
        else if (Map.class.isAssignableFrom(type.getType()))
        {
            info = new TypeInfoMap(type);
        }
View Full Code Here

        if (tagged != null)
        {
            return tagged;
        }

        ClassContainer tempType = type;

        while (!isClassRegisterred(tempType))
        {
            if (tempType == null)
            {
                break;
            }
            else if (tempType.hasParameters())
            {
                tempType = new ClassContainer(tempType.getType());
            }
            else if (tempType.getType().getSuperclass() != null)
            {
                tempType = new ClassContainer(tempType.getType().getSuperclass(), type.getParameters());
            }
            else if (tempType.getType().getSuperclass() == null)
            {
                tempType = null;
            }
        }

        if (tempType == null)
        {
            for (Class inter : type.getType().getInterfaces())
            {
                tempType = new ClassContainer(inter, type.getParameters());

                if (isClassRegisterred(tempType))
                {
                    break;
                }

                tempType = new ClassContainer(inter);

                if (isClassRegisterred(tempType))
                {
                    break;
                }

                tempType = null;
            }
        }

        if (tempType == null)
        {
            registerSaveableClass(type);
            tagged = taggerList.get(type.toString());
            return tagged;
        }

        return taggerList.get(tempType.toString());
    }
View Full Code Here

    }

    @Override
    public TypeData getTypeDataFromObject(ItemStack stack)
    {
        TypeData data = DataStorageManager.getDataForType(new ClassContainer(ItemStack.class));

        data.putField(SIZE, stack.stackSize);
        data.putField(ITEM, GameData.getItemRegistry().getNameForObject(stack.getItem()));
        data.putField(DAMAGE, stack.getItemDamage());
        data.putField(COMPOUND, stack.getTagCompound());
View Full Code Here

        {
            return null;
        }
        else if (field.equalsIgnoreCase(SIZE) || field.equalsIgnoreCase(DAMAGE))
        {
            return new ClassContainer(int.class);
        }
        else if (field.equalsIgnoreCase(ITEM))
        {
            return new ClassContainer(String.class);
        }
        else if (field.equalsIgnoreCase(COMPOUND))
        {
            return new ClassContainer(NBTTagCompound.class);
        }
        else
        {
            return null;
        }
View Full Code Here

    }

    @Override
    public ClassContainer getType()
    {
        return new ClassContainer(ItemStack.class);
    }
View Full Code Here

    public void build()
    {
        Class<?> currentType = container.getType();
        Class<?> tempType;
        Type aTempType;
        ClassContainer tempContainer;

        do
        {
            // Locate all members that are saveable.
            for (Field f : currentType.getDeclaredFields())
            {
                // if its a saveable field
                if (!Modifier.isTransient(f.getModifiers()) && !Modifier.isStatic(f.getModifiers()))
                {
                    tempType = f.getType();
                    aTempType = f.getGenericType();
                    if (aTempType instanceof ParameterizedType)
                    {
                        Type[] types = ((ParameterizedType) aTempType).getActualTypeArguments();
                        Class[] params = new Class[types.length];
                        for (int i = 0; i < types.length; i++)
                        {
                            if (types[i] instanceof Class)
                            {
                                params[i] = (Class<?>) types[i];
                            }
                            else if (types[i] instanceof ParameterizedType)
                            {
                                params[i] = (Class<?>) ((ParameterizedType) types[i]).getRawType();
                            }
                        }

                        tempContainer = new ClassContainer(tempType, params);
                        fields.put(f.getName(), tempContainer);
                    }
                    else
                    {
                        tempContainer = new ClassContainer(tempType);
                        fields.put(f.getName(), tempContainer);
                    }
                }

                // check for UniqueKey
View Full Code Here

    }

    @Override
    public void buildEntry(HashMap<String, ClassContainer> entryFields)
    {
        entryFields.put(POS, new ClassContainer(int.class));
        entryFields.put(ELEMENT, new ClassContainer(container.getType().getComponentType()));
    }
View Full Code Here

    }

    @Override
    public void build(HashMap<String, ClassContainer> fields)
    {
        fields.put(LENGTH, new ClassContainer(int.class));
    }
View Full Code Here

    }

    @Override
    public void buildEntry(HashMap<String, ClassContainer> fields)
    {
        fields.put(POS, new ClassContainer(int.class));
        fields.put(ELEMENT, new ClassContainer(container.getParameters()[0]));
    }
View Full Code Here

TOP

Related Classes of com.forgeessentials.data.api.ClassContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.