ru.novosoft.dc.core
Class StringEnumeration

java.lang.Object
  |
  +--ru.novosoft.dc.core.StringEnumeration

public final class StringEnumeration
extends java.lang.Object

The string enumeration filters objects and returns those of them, which match the following conditions: are String instances and start with the specified prefix. The use of an instance of this class is quite similar to the use of enumerations: the hasMoreMatchingStrings() method tests the enumeration to contain a matching string and the nextTrimmedString() method returns the next matching string without prefix. One more method, namely fullString(), is used if non-trimmed string is needed. It returns the last matching string found.


Constructor Summary
StringEnumeration(java.util.Enumeration enumeration, java.lang.String prefix)
          Constructor.
 
Method Summary
 java.lang.String fullString()
          Return the last matching string found (it is recommended to use this method after successful call of hasMoreMatchingStrings() or nextTrimmedString() methods).
 boolean hasMoreMatchingStrings()
          Test the inner enumeration to contain a matching string and return true if such a string found.
 java.lang.String nextTrimmedString()
          Extract the next matching string, trim its prefix, and return the result.
static void setSystemProperties(java.util.Properties properties)
          Extract properties starting with "system." prefix from the input parameter, removes the prefix from their names, test them to be unspecified as system properties, and set them if the testing successful.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringEnumeration

public StringEnumeration(java.util.Enumeration enumeration,
                         java.lang.String prefix)
Constructor.
Parameters:
enumeration - a enumeration to be filtered
prefix - a prefix of strings to be filtered
Method Detail

hasMoreMatchingStrings

public boolean hasMoreMatchingStrings()
Test the inner enumeration to contain a matching string and return true if such a string found.

nextTrimmedString

public java.lang.String nextTrimmedString()
Extract the next matching string, trim its prefix, and return the result.
Throws:
NoSuchElementException - if no more matching string exist

fullString

public final java.lang.String fullString()
Return the last matching string found (it is recommended to use this method after successful call of hasMoreMatchingStrings() or nextTrimmedString() methods).

setSystemProperties

public static void setSystemProperties(java.util.Properties properties)
Extract properties starting with "system." prefix from the input parameter, removes the prefix from their names, test them to be unspecified as system properties, and set them if the testing successful. For example, if the input parameter contains the property "system.rtf.parse.ignore-case" and the "rtf.parse.ignore-case" key does not specified as a system property, it will be specified with the value of original property.


Other Novosoft LLC products:
Handy Backup Handy Password manager