Exemplo n.º 1
0
 /* (non-Javadoc)
  * @see com.limegroup.gnutella.gui.search.SearchResult#getFilenameNoExtension()
  */
 public String getFilenameNoExtension() {
   String fullname = getFileName();
   if (fullname == null) {
     throw new NullPointerException("getFileName() can't return a null result");
   }
   int i = fullname.lastIndexOf(".");
   if (i < 0) return fullname;
   return I18NConvert.instance().compose(fullname.substring(0, i));
 }
 /**
  * Sets the given value for the supplied property key. Nothing is set if the value is empty or
  * null. If the supplied value is a String, it is passed through the I18NConvert.compose method
  * before being set.
  */
 public static void set(Map<FilePropertyKey, Object> map, FilePropertyKey property, Object value) {
   // Insert nothing if value is null|empty.
   if (value != null && !value.toString().isEmpty()) {
     if (value instanceof String) {
       if (FilePropertyKey.isLong(property)) {
         value = CommonUtils.parseLongNoException((String) value);
       } else {
         value = I18NConvert.instance().compose((String) value).intern();
       }
     }
     map.put(property, value);
   }
 }