List of usage examples for java.util Stack Stack
public Stack()
From source file:com.hubspot.utils.circuitbreaker.CircuitBreakerWrapper.java
/** * Wraps the supplied object toWrap in a CircuitBreaker conforming to the supplied CircuitBreakerPolicy. */// ww w. ja v a 2 s . c o m public <T, W extends T> T wrap(W toWrap, Class<T> interfaceToProxy, CircuitBreakerPolicy policy) throws CircuitBreakerWrappingException { sanityCheck(toWrap, interfaceToProxy, policy); // walk the chain of interfaces implemented by T and check for their blacklisted methods Stack<Class<?>> implementedInterfaces = new Stack<Class<?>>(); implementedInterfaces.addAll(Arrays.asList(interfaceToProxy.getInterfaces())); implementedInterfaces.add(interfaceToProxy); Map<Method, Class[]> blacklist = new HashMap(); while (!implementedInterfaces.isEmpty()) { Class<?> implementedInterface = implementedInterfaces.pop(); for (Method m : implementedInterface.getDeclaredMethods()) { // check that the blacklisted method throws CircuitBreakerException if (m.isAnnotationPresent(CircuitBreakerExceptionBlacklist.class)) { if (!ArrayUtils.contains(m.getExceptionTypes(), CircuitBreakerException.class)) { throw new CircuitBreakerWrappingException( "Wrapped methods must throw CircuitBreakerException"); } CircuitBreakerExceptionBlacklist a = (CircuitBreakerExceptionBlacklist) m .getAnnotation(CircuitBreakerExceptionBlacklist.class); blacklist.put(m, a.blacklist()); } } implementedInterfaces.addAll(Arrays.asList(implementedInterface.getInterfaces())); } Class<?>[] interfaces = new Class<?>[] { interfaceToProxy }; InvocationHandler handler = new CircuitBreakerInvocationHandler(toWrap, blacklist, policy); T newProxyInstance = (T) Proxy.newProxyInstance(getClass().getClassLoader(), interfaces, handler); return newProxyInstance; }
From source file:com.wavemaker.json.AlternateJSONTransformer.java
public static Object toObject(JSONState jsonState, Object obj, FieldDefinition fieldDefinition) { return toObjectInternal(jsonState, obj, obj, fieldDefinition, jsonState.getTypeState(), 0, new Stack<String>()); }
From source file:NimbleTree.java
/** Copy constructor * @param n copied tree// w w w .ja va 2s . co m */ public NimbleTree(NimbleTree<E> n) { this.root = n.root; this.currentNode = n.currentNode; this.nodeCount = n.nodeCount; this.freeNodes = new Stack<TreeNode<E>>(); this.depth = n.depth; this.currentLevel = n.currentLevel; }
From source file:XMLOutputLister.java
public XMLOutputLister(SymMap sm, BufferedWriter bw, String oen, String wan) { symmap = sm;/*w ww. j a va2 s . c o m*/ bwriter = bw; intStack = new Stack<Integer>(); outputElmtName = oen; weightAttrName = wan; }
From source file:org.ojai.beans.jackson.DocumentGenerator.java
public DocumentGenerator(DocumentBuilder db) { b = db; mapCtxts = new Stack<Boolean>(); }
From source file:DepthFirstPathTreeIterator.java
/** Construct a new DepthFirstPathTreeIterator with the specified root. /*from w ww. j a v a 2s . co m*/ @param root The root path */ public DepthFirstPathTreeIterator(String root, ServletContext servletContext) { this.root = root; this.servletContext = servletContext; this.currentIndex = 0; this.currentList = getPathArray(root); this.directories = new Stack(); this.indeces = new Stack(); }
From source file:net.sf.jabref.help.HelpContent.java
public HelpContent(JabRefPreferences prefs_) { super();//w ww .j a va 2s . co m pane = new JScrollPane(this, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); pane.setDoubleBuffered(true); prefs = prefs_; history = new Stack<URL>(); forw = new Stack<URL>(); setEditorKitForContentType("text/html", new MyEditorKit()); setContentType("text/html"); setText(""); setEditable(false); // Handles Anchors final HyperlinkListener hyperLinkListener = new HyperlinkListener() { public void hyperlinkUpdate(final HyperlinkEvent e) { if (e.getDescription().startsWith("#")) { scrollToReference(e.getDescription().substring(1)); } } }; addHyperlinkListener(hyperLinkListener); }
From source file:com.googlecode.jweb1t.FolderScanner.java
/** * Create a folder scanner.//from ww w . j a va 2s . c om * * @param aRoot * the root directory. */ public FolderScanner(final File aRoot) { stack = new Stack<File>(); stack.push(aRoot); }
From source file:cn.vlabs.duckling.vwb.tags.ParentTag.java
private Stack<PathElement> getPath(Resource resource) { Set<Integer> nodes = new HashSet<Integer>(); nodes.add(Integer.valueOf(resource.getResourceId())); Stack<PathElement> stack = new Stack<PathElement>(); ViewPortService viewPortService = VWBContext.getContainer().getViewPortService(); ViewPort vp = viewPortService.getViewPort(vwbcontext.getSiteId(), resource.getResourceId()); while (vp != null) { PathElement pe = new PathElement(vp); stack.push(pe);//w ww.j a v a2 s. c om if (!vp.isRoot() && vp.getParent() > 0 && !nodes.contains(Integer.valueOf(vp.getParent()))) { nodes.add(Integer.valueOf(vp.getParent())); vp = viewPortService.getViewPort(vwbcontext.getSiteId(), vp.getParent()); } else { vp = null; } } ; return stack; }
From source file:com.stimulus.archiva.search.EmailFilter.java
public EmailFilter(TokenStream in) { super(in); emailTokenStack = new Stack<Token>(); }