    001/*
    002 * Forge Mod Loader
    003 * Copyright (c) 2012-2013 cpw.
    004 * All rights reserved. This program and the accompanying materials
    005 * are made available under the terms of the GNU Lesser Public License v2.1
    006 * which accompanies this distribution, and is available at
    007 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    008 *
    009 * Contributors:
    010 *     cpw - implementation
    011 */
    012
    013package cpw.mods.fml.common.modloader;
    014
    015import java.lang.reflect.Field;
    016import java.util.Map;
    017
    018/**
    019 * @author cpw
    020 *
    021 */
    022public class ModProperty
    023{
    024    private String info;
    025    private double min;
    026    private double max;
    027    private String name;
    028    private Field field;
    029
    030    public ModProperty(Field f, String info, Double min, Double max, String name)
    031    {
    032        this.field = f;
    033        this.info = info;
    034        this.min = min != null ? min : Double.MIN_VALUE;
    035        this.max = max != null ? max : Double.MAX_VALUE;
    036        this.name = name;
    037    }
    038    public ModProperty(Field field, Map<String, Object> annotationInfo)
    039    {
    040        this(field, (String)annotationInfo.get("info"), (Double)annotationInfo.get("min"), (Double)annotationInfo.get("max"), (String)annotationInfo.get("name"));
    041    }
    042
    043    public String name()
    044    {
    045        return name;
    046    }
    047
    048    public double min()
    049    {
    050        return min;
    051    }
    052
    053    public double max()
    054    {
    055        return max;
    056    }
    057
    058    public String info()
    059    {
    060        return info;
    061    }
    062
    063    public Field field()
    064    {
    065        return field;
    066    }
    067}