1 27 28 package org.objectweb.speedo.metadata; 29 30 import org.objectweb.speedo.api.SpeedoException; 31 import org.objectweb.speedo.sequence.lib.SpeedoSequence; 32 import org.objectweb.util.monolog.api.Logger; 33 34 import java.util.HashMap ; 35 import java.util.Iterator ; 36 import java.util.Map ; 37 38 42 public class SpeedoPackage extends SpeedoElement { 43 46 public String name; 47 48 52 public Map jdoClass = new HashMap (); 53 54 58 public Map jdoSequence = new HashMap (); 59 60 63 public SpeedoXMLDescriptor jdoXMLDescriptor; 64 65 69 public String toString() { 70 String s = "package\tname : " + name; 71 s += "\n\tclasses: "; 72 Iterator it = jdoClass.values().iterator(); 73 while (it.hasNext()) { 74 s = s + " " + it.next().toString(); 75 } 76 s += "\n\tsequences: "; 77 it = jdoSequence.values().iterator(); 78 while (it.hasNext()) { 79 s = s + " " + it.next().toString(); 80 } 81 return s; 82 } 83 84 92 public void addClass(Object clazz, boolean failsOnError, Logger logger) throws SpeedoException { 93 SpeedoClass sc = (SpeedoClass) clazz; 94 if (jdoClass.containsKey(sc.name)) { 96 SpeedoClass cref = (SpeedoClass) jdoClass.get(sc.name); 98 Iterator it = sc.jdoField.values().iterator(); 99 while (it.hasNext()) { 100 cref.add(it.next(), failsOnError, logger); 101 } 102 } 103 else { 105 sc.jdoPackage = this; 106 jdoClass.put(sc.name, sc); 107 } 108 } 109 110 115 public void addSequence(Object sequence){ 116 SpeedoSequence ss = (SpeedoSequence) sequence; 117 if (!jdoSequence.containsKey(ss.name)) { 119 ss.packageName = this.name; 121 jdoSequence.put(ss.name, ss); 123 } 124 } 125 } | Popular Tags |