Make ASMDataTable more useful: (#2911)

- EnumHolder now has getters for it's data
- enum arrays work now
- nested annotations work now outside of being in arrays
(cherry picked from commit f10f750)
This commit is contained in:
diesieben07 2016-06-22 22:40:27 -04:00 committed by cpw
parent ba9ec61648
commit 5604e3f380
1 changed files with 28 additions and 15 deletions

View File

@ -1,13 +1,20 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* Minecraft Forge
* Copyright (c) 2016.
*
* Contributors:
* cpw - implementation
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.fml.common.discovery.asm;
@ -27,8 +34,8 @@ public class ModAnnotation
{
public class EnumHolder
{
private String desc;
private String value;
private final String desc;
private final String value;
public EnumHolder(String desc, String value)
{
@ -36,6 +43,15 @@ public class ModAnnotation
this.value = value;
}
public String getDesc()
{
return desc;
}
public String getValue()
{
return value;
}
}
AnnotationType type;
Type asmType;
@ -100,7 +116,7 @@ public class ModAnnotation
public void addEnumProperty(String key, String enumName, String value)
{
values.put(key, new EnumHolder(enumName, value));
addProperty(key, new EnumHolder(enumName, value));
}
public void endArray()
@ -111,10 +127,7 @@ public class ModAnnotation
public ModAnnotation addChildAnnotation(String name, String desc)
{
ModAnnotation child = new ModAnnotation(AnnotationType.SUBTYPE, Type.getType(desc), this);
if (arrayList != null)
{
arrayList.add(child.getValues());
}
addProperty(name, child.getValues());
return child;
}
}