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 015 package cpw.mods.fml.common.modloader; 016 017 import java.lang.reflect.Field; 018 import java.util.Map; 019 020 /** 021 * @author cpw 022 * 023 */ 024 public 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 * @return 046 */ 047 public String name() 048 { 049 return name; 050 } 051 /** 052 * @return 053 */ 054 public double min() 055 { 056 return min; 057 } 058 /** 059 * @return 060 */ 061 public double max() 062 { 063 return max; 064 } 065 /** 066 * @return 067 */ 068 public String info() 069 { 070 return info; 071 } 072 073 public Field field() 074 { 075 return field; 076 } 077 }