Examples of HashMap


Examples of java.util.HashMap

    if (manager == null) {
      manager = new ServiceManager();
    }

    if (manager.trackers == null) {
      manager.trackers = new HashMap();
    }
    save();
  }
View Full Code Here

Examples of java.util.HashMap

        public String getSearchKey() {
          return searchKey;
        }
        public HashMap getConditions() {
          if (site != null) {
            HashMap conds = new HashMap();
            conds.put("site.id", new Integer(site.getId()));
            return conds;
          }
          return null;
        }
 
View Full Code Here

Examples of java.util.HashMap

  /**
   * @param bean The instance that has properties named according to JavaBean standard.
   * @return Map<String, Object> that should be considered immutable
   */
  protected Map getBeanProperties(Object bean) {
    HashMap values = new HashMap();
    if (bean == null) return values;
    Method[] m = bean.getClass().getMethods();
   
    Pattern p = Pattern.compile("get([A-Z]\\w+)");
   
    for (int i = 0; i < m.length; i++) {
      if (m[i].getName().equals("getClass")) continue;
      if (m[i].getParameterTypes().length > 0) continue;
      Matcher r = p.matcher(m[i].getName());
      if (r.matches()) {
        try {
          values.put(r.group(1).toLowerCase(), m[i].invoke(bean, new Object[0]));
        } catch (IllegalArgumentException e) {
          throw e;
        } catch (IllegalAccessException e) {
          throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
View Full Code Here

Examples of java.util.HashMap

        }
    }

    static class HashEntityMap extends MapIntMap {
        public HashEntityMap() {
            mapNameToValue = new HashMap();
            mapValueToName = new HashMap();
        }
View Full Code Here

Examples of java.util.HashMap

            lastModified = directory.lastModified();

            File[] list = directory.listFiles();

            ArrayList newRepositories = new ArrayList(list.length);
            HashMap newResources = new HashMap(list.length);

            for (int i = 0; i < list.length; i++) {
                // create both directories and zip files as top-level repositories,
                // while resources (files) are ignored.
                if (list[i].isDirectory()) {
View Full Code Here

Examples of java.util.HashMap

        assertTrue(keys.contains(null));
        assertTrue(keys.size() == 3);
    }
       
    public void testPutAll() {
        Map map = new HashMap();
        map.put("One", "One");
        map.put("Two", "Two");
        map.put("one", "Three");
        map.put(null, "Four");
        map.put(new Integer(20), "Five");
        Map caseInsensitiveMap = new CaseInsensitiveMap(map);
        assertTrue(caseInsensitiveMap.size() == 4); // ones collapsed
        Set keys = caseInsensitiveMap.keySet();
        assertTrue(keys.contains("one"));
        assertTrue(keys.contains("two"));
View Full Code Here

Examples of java.util.HashMap

     */
    public synchronized void update() {
        if (!directory.exists()) {
            repositories = emptyRepositories;
            if (resources == null) {
                resources = new HashMap();
            } else {
                resources.clear();
            }
            lastModified = 0;
            return;
        }

        if (directory.lastModified() != lastModified) {
            lastModified = directory.lastModified();

            File[] list = directory.listFiles();

            ArrayList newRepositories = new ArrayList(list.length);
            HashMap newResources = new HashMap(list.length);

            for (int i = 0; i < list.length; i++) {
                if (list[i].isDirectory()) {
                    // a nested directory aka child file repository
                    newRepositories.add(new FileRepository(list[i], this));
                } else if (list[i].getName().endsWith(".zip")) {
                    // a nested zip repository
                    newRepositories.add(new ZipRepository(list[i], this));
                } else if (list[i].isFile()) {
                    // a file resource
                    FileResource resource = new FileResource(list[i], this);
                    newResources.put(resource.getShortName(), resource);
                }
            }

            repositories = (Repository[])
                    newRepositories.toArray(new Repository[newRepositories.size()]);
View Full Code Here

Examples of java.util.HashMap

        SAXParser parser = factory.newSAXParser();

        rootNode = helmaNode;
        currentNode = null;
        convertedNodes = new HashMap();
        nodeStack = new Stack();
        parsingHopObject = true;

        parser.parse(in, this);
View Full Code Here

Examples of java.util.HashMap

    public INode convert(InputStream in, INode helmaNode)
                  throws RuntimeException {
        Document document = XmlUtil.parse(in);

        if ((document != null) && (document.getDocumentElement() != null)) {
            return convert(document.getDocumentElement(), helmaNode, new HashMap());
        } else {
            return helmaNode;
        }
    }
View Full Code Here

Examples of java.util.HashMap

    public INode convertFromString(String xml, INode helmaNode)
                            throws RuntimeException {
        Document document = XmlUtil.parse(new InputSource(new StringReader(xml)));

        if ((document != null) && (document.getDocumentElement() != null)) {
            return convert(document.getDocumentElement(), helmaNode, new HashMap());
        } else {
            return helmaNode;
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.