1 package com.genimen.djeneric.tools.generator.core.util; 2 3 import java.util.Stack ; 4 5 public class ObjectStack extends Stack 6 { 7 private static final long serialVersionUID = 1L; 8 9 public ObjectStack() 10 { 11 } 12 13 public ContextObject push(String name, Object obj) 14 { 15 return (ContextObject) push(new ContextObject(name, obj)); 16 } 17 18 public ContextObject getContextObject(int i) 19 { 20 return (ContextObject) get(i); 21 } 22 23 public Object lookup(String name) 24 { 25 for (int i = size() - 1; i >= 0; i--) 26 { 27 ContextObject obj = getContextObject(i); 28 if (obj.getName().equals(name)) return obj.getObject(); 29 } 30 return null; 31 } 32 33 } | Popular Tags |