Package java.util.Map

Examples of java.util.Map.Entry


     *            The extra property validation rules for this validator. The map should hold the property names as keys
     *            and {@link ValidationRule} instances as values.
     */
    public void setExtraPropertyValidationRules(Map rulesByProperty) {
        for (Iterator entries = rulesByProperty.entrySet().iterator(); entries.hasNext();) {
            Entry entry = (Entry) entries.next();
            addPropertyRule((String) entry.getKey(), (ValidationRule) entry.getValue());
        }
    }
View Full Code Here


     * @param errors The {@link Errors} instance where all validation errors will be registered.
     * @param validatedObjects A registry of all objects that were already validated.
     */
    protected void validateMapProperty(Object root, Map map, String propertyName, Errors errors, Set validatedObjects) {
        for (Iterator entries = map.entrySet().iterator(); entries.hasNext();) {
            Entry entry = (Entry) entries.next();
            Object key = entry.getKey();
            if (!(key instanceof String)) {
                // skipping validation of elements that are mapped to non-string keys for there is no proper
                // representation of such elements as property path.
                continue;
            }
            Object value = entry.getValue();
            String nestedPath = propertyName + PROPERTY_KEY_PREFIX + String.valueOf(key) + PROPERTY_KEY_SUFFIX;
            errors.pushNestedPath(nestedPath);
            validateObjectGraphConstraints(root, value, errors, validatedObjects);
            errors.popNestedPath();
        }
View Full Code Here

    if (indexProperties) {
      Properties props = docData.getProps();
      if (props != null) {
        for (Iterator iterator = props.entrySet().iterator(); iterator.hasNext();) {
          Entry entry = (Entry) iterator.next();
          Field f = ds.getField((String) entry.getKey(), storeVal, indexVal, termVecVal);
          f.setValue((String) entry.getValue());
          doc.add(f);
        }
        docData.setProps(null);
      }
    }
View Full Code Here

    // Remap delete-by-term
    if (terms.size() > 0) {
      newDeleteTerms = new HashMap();
      Iterator iter = terms.entrySet().iterator();
      while(iter.hasNext()) {
        Entry entry = (Entry) iter.next();
        Num num = (Num) entry.getValue();
        newDeleteTerms.put(entry.getKey(),
                           new Num(mapper.remap(num.getNum())));
      }
    } else
      newDeleteTerms = null;

    // Remap delete-by-docID
    final List newDeleteDocIDs;

    if (docIDs.size() > 0) {
      newDeleteDocIDs = new ArrayList(docIDs.size());
      Iterator iter = docIDs.iterator();
      while(iter.hasNext()) {
        Integer num = (Integer) iter.next();
        newDeleteDocIDs.add(new Integer(mapper.remap(num.intValue())));
      }
    } else
      newDeleteDocIDs = null;

    // Remap delete-by-query
    final HashMap newDeleteQueries;
   
    if (queries.size() > 0) {
      newDeleteQueries = new HashMap(queries.size());
      Iterator iter = queries.entrySet().iterator();
      while(iter.hasNext()) {
        Entry entry = (Entry) iter.next();
        Integer num = (Integer) entry.getValue();
        newDeleteQueries.put(entry.getKey(),
                             new Integer(mapper.remap(num.intValue())));
      }
    } else
      newDeleteQueries = null;
View Full Code Here

    // Delete by term
    Iterator iter = deletesFlushed.terms.entrySet().iterator();
    TermDocs docs = reader.termDocs();
    try {
      while (iter.hasNext()) {
        Entry entry = (Entry) iter.next();
        Term term = (Term) entry.getKey();

        docs.seek(term);
        int limit = ((BufferedDeletes.Num) entry.getValue()).getNum();
        while (docs.next()) {
          int docID = docs.doc();
          if (docIDStart+docID >= limit)
            break;
          reader.deleteDocument(docID);
          any = true;
        }
      }
    } finally {
      docs.close();
    }

    // Delete by docID
    iter = deletesFlushed.docIDs.iterator();
    while(iter.hasNext()) {
      int docID = ((Integer) iter.next()).intValue();
      if (docID >= docIDStart && docID < docEnd) {
        reader.deleteDocument(docID-docIDStart);
        any = true;
      }
    }

    // Delete by query
    IndexSearcher searcher = new IndexSearcher(reader);
    iter = deletesFlushed.queries.entrySet().iterator();
    while(iter.hasNext()) {
      Entry entry = (Entry) iter.next();
      Query query = (Query) entry.getKey();
      int limit = ((Integer) entry.getValue()).intValue();
      Weight weight = query.weight(searcher);
      Scorer scorer = weight.scorer(reader, true, false);
      if (scorer != null) {
        while(true)  {
          int doc = scorer.nextDoc();
View Full Code Here

    }
   
    // now the interfaces
    Iterator/*<Entry<Class<Attribute>, AttributeImpl>>*/ attIt = this.attributes.entrySet().iterator();
    while (attIt.hasNext()) {
      Entry/*<Class<Attribute>, AttributeImpl>*/ entry = (Entry/*<Class<Attribute>, AttributeImpl>*/) attIt.next();
      clone.attributes.put(entry.getKey(), clone.attributeImpls.get(entry.getValue().getClass()));
    }
   
    return clone;
  }
View Full Code Here

                out
                        .println("<table border=\"1\"><tr><th>Key</th><th>Value</th></tr>");

                Iterator it = headers.entrySet().iterator();
                while (it.hasNext()) {
                    Entry e = (Entry) it.next();
                    out.println("<tr><td>" + e.getKey() + "</td><td>"
                            + e.getValue() + "</td></tr>");
                }

                out.println("</table>");

                for (int i = 0; i < 1024; i++) {
                    out.println("this is line: " + i + "<br/>");
                }

                out.println("</body></html>");
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                out.flush();
                out.close();
                try {
                    in.close();
View Full Code Here

                break;
            }
            buf.put(CRLF);
            for (Iterator it = msg.getHeaders().entrySet().iterator(); it
                    .hasNext();) {
                Entry entry = (Entry) it.next();
                buf.putString((String) entry.getKey(), encoder);
                buf.putString(": ", encoder);
                buf.putString((String) entry.getValue(), encoder);
                buf.put(CRLF);
            }
            // now the content length is the body length
            buf.putString("Content-Length: ", encoder);
            buf.putString(String.valueOf(msg.getBodyLength()), encoder);
View Full Code Here

    public String toString() {
        StringBuilder str = new StringBuilder();

        Iterator it = headers.entrySet().iterator();
        while (it.hasNext()) {
            Entry e = (Entry) it.next();
            str.append(e.getKey() + " : "
                    + arrayToString((String[]) e.getValue(), ',') + "\n");
        }
        return str.toString();
    }
View Full Code Here

        {
            Properties envVars = CommandLineUtils.getSystemEnvVars();
            Iterator i = envVars.entrySet().iterator();
            while ( i.hasNext() )
            {
                Entry e = (Entry) i.next();
                executionProperties.setProperty( "env." + e.getKey().toString(), e.getValue().toString() );
            }
        }
        catch ( IOException e )
        {
            System.err.println( "Error getting environment vars for profile activation: " + e );
View Full Code Here

TOP

Related Classes of java.util.Map.Entry

Copyright © 2018 www.massapicom. 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.