1 package net.sf.quarrel.file; 2 3 import java.util.Collection; 4 import java.util.Map; 5 6 /*** 7 * The default implementation of the FileElement interface. 8 */ 9 public final class ElementImpl implements FileElement { 10 11 /*** 12 * A mapping of 13 */ 14 private final Map _features; 15 private final String _name; 16 private final ElementType _type; 17 18 public ElementImpl(final String name, 19 final ElementType type, 20 final Map features) { 21 _features = features; 22 _name = name; 23 _type = type; 24 } 25 26 public String getName() { 27 return _name; 28 } 29 30 public ElementType getElementType() { 31 return _type; 32 } 33 34 public Collection getFeatures(FeatureType featureType) { 35 36 if (!_type.getFeatures().contains(featureType)) { 37 throw new IllegalArgumentException("FileElement type [" + 38 _type.getName() + 39 "] does not support feature [" + 40 featureType.getName() + 41 "]"); 42 } 43 44 return (Collection) _features.get(featureType); 45 46 } 47 48 }