Java Code Examples for java.util.Properties#values()

The following examples show how to use java.util.Properties#values() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Test
public void testInteropolateProperties() throws Exception
{
    final Model model = TestUtils.resolveModelResource( RESOURCE_BASE, "infinispan-bom-8.2.0.Final.pom" );

    Project p = new Project( model );

    Properties props = p.getModel().getProperties();
    boolean containsProperty = false;
    for ( Object o : props.values() )
    {
        if ( ( (String) o ).contains( "${" ) )
        {
            containsProperty = true;
            break;
        }
    }
    assertTrue( containsProperty );
    PropertyInterpolator pi = new PropertyInterpolator( props, p );
    assertEquals( "5.0.4.Final", pi.interp( "${version.hibernate.osgi}" ) );
}
 
Example 2
Source Project: netbeans   File: TaskCache.java    License: Apache License 2.0 5 votes vote down vote up
@NonNull
private static String computeFreeName(@NonNull final Properties props) {
    int lastUsed = 0;
    for (Object value : props.values()) {
        int current = Integer.parseInt((String)value);
        if (lastUsed < current) {
            lastUsed = current;
        }
    }
    return Integer.toString(lastUsed+1);
}
 
Example 3
Source Project: lucene-solr   File: LineDocSourceTest.java    License: Apache License 2.0 5 votes vote down vote up
private void writeDocsToFile(BufferedWriter writer, boolean addHeader, Properties otherFields) throws IOException {
  if (addHeader) {
    writer.write(WriteLineDocTask.FIELDS_HEADER_INDICATOR);
    writer.write(WriteLineDocTask.SEP);
    writer.write(DocMaker.TITLE_FIELD);
    writer.write(WriteLineDocTask.SEP);
    writer.write(DocMaker.DATE_FIELD);
    writer.write(WriteLineDocTask.SEP);
    writer.write(DocMaker.BODY_FIELD);
    if (otherFields!=null) {
      // additional field names in the header 
      for (Object fn : otherFields.keySet()) {
        writer.write(WriteLineDocTask.SEP);
        writer.write(fn.toString());
      }
    }
    writer.newLine();
  }
  StringBuilder doc = new StringBuilder();
  doc.append("title").append(WriteLineDocTask.SEP).append("date").append(WriteLineDocTask.SEP).append(DocMaker.BODY_FIELD);
  if (otherFields!=null) {
    // additional field values in the doc line 
    for (Object fv : otherFields.values()) {
      doc.append(WriteLineDocTask.SEP).append(fv.toString());
    }
  }
  writer.write(doc.toString());
  writer.newLine();
}
 
Example 4
private int checkSum(Properties p) {
  int res = 0;
  p.remove(CHKSUM_PROP);
  for (Object o : p.values()) {
    if (o instanceof String) {
      res += 997 + 11 * ((String)o).length();
    }
  }
  return res;
}