1 4 package com.tc.object.config; 5 6 import com.tc.util.ClassUtils; 7 import com.tc.util.ClassUtils.ClassSpec; 8 9 import java.text.ParseException ; 10 import java.util.HashMap ; 11 import java.util.Map ; 12 13 16 public class TypeMap { 17 private final Map types = new HashMap (); 18 19 public TypeMap(String [] fieldNames) throws ParseException { 20 for (int i=0; i<fieldNames.length; i++) { 21 ClassSpec spec = ClassUtils.parseFullyQualifiedFieldName(fieldNames[i]); 22 addField(spec.getFullyQualifiedClassName(), spec.getShortFieldName()); 23 } 24 } 25 26 private void addField(String className, String fieldName) { 27 Type type = (Type) types.get(className); 28 if (type == null) { 29 type = new Type(); 30 type.setName(className); 31 types.put(className, type); 32 } 33 type.addTransient(fieldName); 34 } 35 36 public Map getTypes() { 37 return types; 38 } 39 } 40 | Popular Tags |