001/*
002 * The FML Forge Mod Loader suite.
003 * Copyright (C) 2012 cpw
004 *
005 * 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
006 * Software Foundation; either version 2.1 of the License, or any later version.
007 *
008 * 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
009 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
010 *
011 * 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
012 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
013 */
014
015package cpw.mods.fml.common.modloader;
016
017import java.lang.reflect.Field;
018import java.util.Map;
019
020/**
021 * @author cpw
022 *
023 */
024public class ModProperty
025{
026    private String info;
027    private double min;
028    private double max;
029    private String name;
030    private Field field;
031
032    public ModProperty(Field f, String info, Double min, Double max, String name)
033    {
034        this.field = f;
035        this.info = info;
036        this.min = min != null ? min : Double.MIN_VALUE;
037        this.max = max != null ? max : Double.MAX_VALUE;
038        this.name = name;
039    }
040    public ModProperty(Field field, Map<String, Object> annotationInfo)
041    {
042        this(field, (String)annotationInfo.get("info"), (Double)annotationInfo.get("min"), (Double)annotationInfo.get("max"), (String)annotationInfo.get("name"));
043    }
044
045    public String name()
046    {
047        return name;
048    }
049
050    public double min()
051    {
052        return min;
053    }
054
055    public double max()
056    {
057        return max;
058    }
059
060    public String info()
061    {
062        return info;
063    }
064
065    public Field field()
066    {
067        return field;
068    }
069}