1 17 18 19 20 package org.apache.fop.fo.properties; 21 22 import java.util.Map ; 23 import java.util.WeakHashMap ; 24 25 28 public class EnumNumber extends NumberProperty { 29 30 private static final Map cache = new WeakHashMap (); 31 32 private final EnumProperty enumProperty; 33 34 private EnumNumber(EnumProperty enumProperty) { 35 super(null); 36 this.enumProperty = enumProperty; 37 } 38 39 public static EnumNumber getInstance(Property enumProperty) { 40 EnumNumber en = (EnumNumber)cache.get(enumProperty); 41 if (en == null) { 42 en = new EnumNumber((EnumProperty)enumProperty); 43 cache.put(enumProperty, en); 44 } 45 return en; 46 } 47 48 public int getEnum() { 49 return enumProperty.getEnum(); 50 } 51 52 56 public int getValue() { 57 log.error("getValue() called on " + enumProperty + " number"); 58 return 0; 59 } 60 61 65 public double getNumericValue() { 66 log.error("getNumericValue() called on " + enumProperty + " number"); 67 return 0; 68 } 69 70 73 public String getString() { 74 return enumProperty.toString(); 75 } 76 77 80 public Object getObject() { 81 return enumProperty.getObject(); 82 } 83 84 85 } 86 | Popular Tags |