com.helger.commons.ValueEnforcer Java Examples
The following examples show how to use
com.helger.commons.ValueEnforcer.
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
Source File: ByteBuffersInputStream.java From ph-commons with Apache License 2.0 | 6 votes |
/** * Reads as much as possible into the destination buffer. * * @param aDestByteBuffer * The destination byte buffer to use. May not be <code>null</code>. * @return The number of bytes read. Always ≥ 0. */ @Nonnegative public long read (@Nonnull final ByteBuffer aDestByteBuffer) { ValueEnforcer.notNull (aDestByteBuffer, "DestByteBuffer"); _checkClosed (); long nBytesRead = 0; while (m_nBufferIndex < m_aBuffers.length) { final ByteBuffer aByteBuffer = m_aBuffers[m_nBufferIndex]; if (aByteBuffer.hasRemaining ()) nBytesRead += ByteBufferHelper.transfer (aByteBuffer, aDestByteBuffer, false); if (!aDestByteBuffer.hasRemaining ()) break; // Try next ByteBuffer ++m_nBufferIndex; } return nBytesRead; }
Example #2
Source File: CollectionHelper.java From ph-commons with Apache License 2.0 | 6 votes |
/** * Gets a sublist excerpt of the passed list. * * @param <ELEMENTTYPE> * Type of elements in list * @param aCont * The backing list. May not be <code>null</code>. * @param nStartIndex * The start index to use. Needs to be ≥ 0. * @param nSectionLength * the length of the desired subset. If list is shorter than that, * aIter will return a shorter section * @return The specified section of the passed list, or a shorter list if * nStartIndex + nSectionLength is an invalid index. Never * <code>null</code>. */ @Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> CommonsArrayList <ELEMENTTYPE> getSubList (@Nullable final List <ELEMENTTYPE> aCont, @Nonnegative final int nStartIndex, @Nonnegative final int nSectionLength) { ValueEnforcer.isGE0 (nStartIndex, "StartIndex"); ValueEnforcer.isGE0 (nSectionLength, "SectionLength"); final int nSize = getSize (aCont); if (nSize == 0 || nStartIndex >= nSize) return newList (0); int nEndIndex = nStartIndex + nSectionLength; if (nEndIndex > nSize) nEndIndex = nSize; // Create a copy of the list because "subList" only returns a view of the // original list! return newList (aCont.subList (nStartIndex, nEndIndex)); }
Example #3
Source File: IAutoSaveAware.java From ph-commons with Apache License 2.0 | 6 votes |
/** * Execute a callback with autosave being disabled. Must be called outside a * writeLock, as this method locks itself! * * @param aCallable * The callback to be executed * @return The result of the callback. May be <code>null</code>. * @throws EXTYPE * In case of an error * @param <RETURNTYPE> * Return type of the callable * @param <EXTYPE> * Exception type that may be thrown */ @Nullable default <RETURNTYPE, EXTYPE extends Exception> RETURNTYPE performWithoutAutoSaveThrowing (@Nonnull final IThrowingSupplier <RETURNTYPE, EXTYPE> aCallable) throws EXTYPE { ValueEnforcer.notNull (aCallable, "Callable"); beginWithoutAutoSave (); try { // Main call of callable return aCallable.get (); } finally { endWithoutAutoSave (); } }
Example #4
Source File: PreprocessorLookup.java From ph-schematron with Apache License 2.0 | 6 votes |
public PreprocessorLookup (@Nonnull final PSSchema aSchema) { ValueEnforcer.notNull (aSchema, "Schema"); for (final PSPattern aPattern : aSchema.getAllPatterns ()) { // Only handle abstract patterns if (aPattern.isAbstract ()) m_aPatterns.put (aPattern.getID (), aPattern); for (final PSRule aRule : aPattern.getAllRules ()) { // Only handle abstract rules if (aRule.isAbstract ()) m_aRules.put (aRule.getID (), aRule); } } }
Example #5
Source File: FileHelper.java From ph-commons with Apache License 2.0 | 6 votes |
@Nullable public static RandomAccessFile getRandomAccessFile (@Nonnull final File aFile, @Nonnull final ERandomAccessFileMode eMode) { ValueEnforcer.notNull (aFile, "File"); ValueEnforcer.notNull (eMode, "Mode"); try { return new RandomAccessFile (aFile, eMode.getMode ()); } catch (final FileNotFoundException ex) { return null; } }
Example #6
Source File: AbstractXMLSerializer.java From ph-commons with Apache License 2.0 | 6 votes |
/** * Resolve the given namespace URI to a prefix using the known namespaces of * this stack. * * @param sNamespaceURI * The namespace URI to resolve. May not be <code>null</code>. Pass * in an empty string for an empty namespace URI! * @return <code>null</code> if no namespace prefix is required. */ @Nullable private String _getUsedPrefixOfNamespace (@Nonnull final String sNamespaceURI) { ValueEnforcer.notNull (sNamespaceURI, "NamespaceURI"); // find existing prefix (iterate current to root) for (final NamespaceLevel aNSLevel : m_aStack) { final String sPrefix = aNSLevel.getPrefixOfNamespaceURI (sNamespaceURI); if (sPrefix != null) return sPrefix; } // no matching prefix found return null; }
Example #7
Source File: Graph.java From ph-commons with Apache License 2.0 | 6 votes |
@Nonnull public EChange removeNodeAndAllRelations (@Nonnull final IMutableGraphNode aNode) { ValueEnforcer.notNull (aNode, "Node"); if (!m_aNodes.containsKey (aNode.getID ())) return EChange.UNCHANGED; // Remove all affected relations from all nodes for (final IMutableGraphRelation aRelation : aNode.getAllRelations ()) for (final IMutableGraphNode aNode2 : aRelation.getAllConnectedNodes ()) aNode2.removeRelation (aRelation); // Remove the node itself if (removeNode (aNode).isUnchanged ()) throw new IllegalStateException ("Inconsistency removing node and all relations"); return EChange.CHANGED; }
Example #8
Source File: PathOperations.java From ph-commons with Apache License 2.0 | 6 votes |
/** * Create a new directory. The direct parent directory already needs to exist. * * @param aDir * The directory to be created. May not be <code>null</code>. * @return A non-<code>null</code> error code. */ @Nonnull public static FileIOError createDir (@Nonnull final Path aDir) { ValueEnforcer.notNull (aDir, "Directory"); final Path aRealDir = _getUnifiedPath (aDir); return FileOperations.createDir (aRealDir.toFile ()); // // Does the directory already exist? // if (Files.exists (aRealDir)) // return EFileIOErrorCode.TARGET_ALREADY_EXISTS.getAsIOError // (EFileIOOperation.CREATE_DIR, aRealDir); // // // Is the parent directory writable? // final Path aParentDir = aRealDir.getParent (); // if (aParentDir != null && Files.exists (aParentDir) && !Files.isWritable // (aParentDir)) // return EFileIOErrorCode.SOURCE_PARENT_NOT_WRITABLE.getAsIOError // (EFileIOOperation.CREATE_DIR, aRealDir); // // return _perform (EFileIOOperation.CREATE_DIR, Files::createDirectory, // aRealDir); }
Example #9
Source File: ICommonsCollection.java From ph-commons with Apache License 2.0 | 6 votes |
/** * Add all passed elements matching the provided filter after performing a * mapping using the provided function. * * @param aElements * The elements to be added after mapping. May be <code>null</code>. * @param aMapper * The mapping function to be executed for all provided elements. May * not be <code>null</code>. * @param aFilter * The filter to be applied on the mapped element. May be * <code>null</code>. * @return {@link EChange#CHANGED} if at least one element was added, * {@link EChange#UNCHANGED}. Never <code>null</code>. * @param <SRCTYPE> * The source type to be mapped from * @since 8.5.2 */ @Nonnull default <SRCTYPE> EChange addAllMapped (@Nullable final SRCTYPE [] aElements, @Nonnull final Function <? super SRCTYPE, ? extends ELEMENTTYPE> aMapper, @Nullable final Predicate <? super ELEMENTTYPE> aFilter) { ValueEnforcer.notNull (aMapper, "Mapper"); if (aFilter == null) return addAllMapped (aElements, aMapper); EChange eChange = EChange.UNCHANGED; if (aElements != null) for (final SRCTYPE aValue : aElements) { final ELEMENTTYPE aMapped = aMapper.apply (aValue); if (aFilter.test (aMapped)) eChange = eChange.or (add (aMapped)); } return eChange; }
Example #10
Source File: XPathHelper.java From ph-commons with Apache License 2.0 | 6 votes |
/** * Create a new XPath expression for evaluation. * * @param aXPath * The pre-created XPath object. May not be <code>null</code>. * @param sXPath * The main XPath string to be evaluated * @return The {@link XPathExpression} object to be used. * @throws IllegalArgumentException * if the XPath cannot be compiled */ @Nonnull public static XPathExpression createNewXPathExpression (@Nonnull final XPath aXPath, @Nonnull @Nonempty final String sXPath) { ValueEnforcer.notNull (aXPath, "XPath"); ValueEnforcer.notNull (sXPath, "XPathExpression"); try { return aXPath.compile (sXPath); } catch (final XPathExpressionException ex) { throw new IllegalArgumentException ("Failed to compile XPath expression '" + sXPath + "'", ex); } }
Example #11
Source File: CSSPropertyEnumOrNumbers.java From ph-css with Apache License 2.0 | 6 votes |
public CSSPropertyEnumOrNumbers (@Nonnull final ECSSProperty eProp, @Nullable final ECSSVendorPrefix eVendorPrefix, @Nullable final ICSSPropertyCustomizer aCustomizer, final boolean bWithPercentage, @Nonnegative final int nMinNumbers, @Nonnegative final int nMaxNumbers, @Nonnull @Nonempty final Iterable <String> aEnumValues) { super (eProp, eVendorPrefix, aCustomizer, aEnumValues); ValueEnforcer.isGT0 (nMinNumbers, "MinNumbers"); ValueEnforcer.isGT0 (nMaxNumbers, "MaxNumbers"); if (nMaxNumbers < nMinNumbers) throw new IllegalArgumentException ("MaxNumbers (" + nMaxNumbers + ") must be >= MinNumbers (" + nMinNumbers + ")"); m_bWithPercentage = bWithPercentage; m_nMinNumbers = nMinNumbers; m_nMaxNumbers = nMaxNumbers; }
Example #12
Source File: SizeLong.java From ph-commons with Apache License 2.0 | 5 votes |
@Nonnull @CheckReturnValue public SizeLong getScaledToHeight (@Nonnegative final long nNewHeight) { ValueEnforcer.isGT0 (nNewHeight, "NewHeight"); if (m_nHeight == nNewHeight) return this; final double dMultFactory = MathHelper.getDividedDouble (nNewHeight, m_nHeight); return new SizeLong ((long) (m_nWidth * dMultFactory), nNewHeight); }
Example #13
Source File: PSDir.java From ph-schematron with Apache License 2.0 | 5 votes |
public void addForeignElement (@Nonnull final IMicroElement aForeignElement) { ValueEnforcer.notNull (aForeignElement, "ForeignElement"); if (aForeignElement.hasParent ()) throw new IllegalArgumentException ("ForeignElement already has a parent!"); m_aContent.add (aForeignElement); }
Example #14
Source File: JsonParser.java From ph-commons with Apache License 2.0 | 5 votes |
@Nonnull public JsonParser setTabSize (@Nonnegative final int nTabSize) { ValueEnforcer.isGT0 (nTabSize, "TabSize"); m_nTabSize = nTabSize; return this; }
Example #15
Source File: CascadingStyleSheet.java From ph-css with Apache License 2.0 | 5 votes |
/** * Add a new <code>@namespace</code> rule at the end of the * <code>@namespace</code> rule list. * * @param aNamespaceRule * The namespace rule to be added. May not be <code>null</code>. * @return this */ @Nonnull public CascadingStyleSheet addNamespaceRule (@Nonnull final CSSNamespaceRule aNamespaceRule) { ValueEnforcer.notNull (aNamespaceRule, "NamespaceRule"); m_aNamespaceRules.add (aNamespaceRule); return this; }
Example #16
Source File: PathOperations.java From ph-commons with Apache License 2.0 | 5 votes |
/** * Rename a file. * * @param aSourceFile * The original file name. May not be <code>null</code>. * @param aTargetFile * The destination file name. May not be <code>null</code>. * @return A non-<code>null</code> error code. */ @Nonnull public static FileIOError renameFile (@Nonnull final Path aSourceFile, @Nonnull final Path aTargetFile) { ValueEnforcer.notNull (aSourceFile, "SourceFile"); ValueEnforcer.notNull (aTargetFile, "TargetFile"); final Path aRealSourceFile = _getUnifiedPath (aSourceFile); final Path aRealTargetFile = _getUnifiedPath (aTargetFile); // Does the source file exist? if (!aRealSourceFile.toFile ().isFile ()) return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile); // Are source and target different? if (EqualsHelper.equals (aRealSourceFile, aRealTargetFile)) return EFileIOErrorCode.SOURCE_EQUALS_TARGET.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile); // Does the target file already exist? if (aRealTargetFile.toFile ().exists ()) return EFileIOErrorCode.TARGET_ALREADY_EXISTS.getAsIOError (EFileIOOperation.RENAME_FILE, aRealTargetFile); // Is the source parent directory writable? final Path aSourceParentDir = aRealSourceFile.getParent (); if (aSourceParentDir != null && !Files.isWritable (aSourceParentDir)) return EFileIOErrorCode.SOURCE_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile); // Is the target parent directory writable? final Path aTargetParentDir = aRealTargetFile.getParent (); if (aTargetParentDir != null && aTargetParentDir.toFile ().exists () && !Files.isWritable (aTargetParentDir)) return EFileIOErrorCode.TARGET_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.RENAME_FILE, aRealTargetFile); // Ensure parent of target directory is present PathHelper.ensureParentDirectoryIsPresent (aRealTargetFile); return _perform (EFileIOOperation.RENAME_FILE, PathOperations::_atomicMove, aRealSourceFile, aRealTargetFile); }
Example #17
Source File: SchematronResourcePure.java From ph-schematron with Apache License 2.0 | 5 votes |
@Nonnull public EValidity getSchematronValidity (@Nonnull final Node aXMLNode, @Nullable final String sBaseURI) throws Exception { ValueEnforcer.notNull (aXMLNode, "XMLNode"); if (!isValidSchematron ()) return EValidity.INVALID; return getOrCreateBoundSchema ().validatePartially (aXMLNode, sBaseURI); }
Example #18
Source File: CSSStyleRule.java From ph-css with Apache License 2.0 | 5 votes |
@Nonnull public CSSStyleRule addSelector (@Nonnegative final int nIndex, @Nonnull final CSSSelector aSelector) { ValueEnforcer.isGE0 (nIndex, "Index"); ValueEnforcer.notNull (aSelector, "Selector"); if (nIndex >= getSelectorCount ()) m_aSelectors.add (aSelector); else m_aSelectors.add (nIndex, aSelector); return this; }
Example #19
Source File: StatisticsManager.java From ph-commons with Apache License 2.0 | 5 votes |
@Nonnull public static IMutableStatisticsHandlerTimer getTimerHandler (@Nonnull final Class <?> aClass) { ValueEnforcer.notNull (aClass, "Class"); return getTimerHandler (aClass.getName ()); }
Example #20
Source File: CSSWriterSettings.java From ph-css with Apache License 2.0 | 5 votes |
@Nonnull public final CSSWriterSettings setCSSVersion (@Nonnull final ECSSVersion eCSSVersion) { ValueEnforcer.notNull (eCSSVersion, "CSSVersion"); m_eCSSVersion = eCSSVersion; return this; }
Example #21
Source File: MimeType.java From ph-commons with Apache License 2.0 | 5 votes |
@Nonnull public String getParametersAsString (@Nonnull final EMimeQuoting eQuotingAlgorithm) { ValueEnforcer.notNull (eQuotingAlgorithm, "QuotingAlgorithm"); if (m_aParameters.isEmpty ()) return ""; return _getParametersAsString (eQuotingAlgorithm); }
Example #22
Source File: AuthIdentificationManager.java From ph-commons with Apache License 2.0 | 5 votes |
/** * Validate the login credentials, try to resolve the subject and create a * token upon success. * * @param aCredentials * The credentials to validate. If <code>null</code> it is treated as * error. * @return Never <code>null</code>. */ @Nonnull public static AuthIdentificationResult validateLoginCredentialsAndCreateToken (@Nonnull final IAuthCredentials aCredentials) { ValueEnforcer.notNull (aCredentials, "Credentials"); // validate credentials final ICredentialValidationResult aValidationResult = AuthCredentialValidatorManager.validateCredentials (aCredentials); if (aValidationResult.isFailure ()) { if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Credentials have been rejected: " + aCredentials); return AuthIdentificationResult.createFailure (aValidationResult); } if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Credentials have been accepted: " + aCredentials); // try to get AuthSubject from passed credentials final IAuthSubject aSubject = AuthCredentialToSubjectResolverManager.getSubjectFromCredentials (aCredentials); if (aSubject != null) { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Credentials " + aCredentials + " correspond to subject " + aSubject); } else { if (LOGGER.isErrorEnabled ()) LOGGER.error ("Failed to resolve credentials " + aCredentials + " to an auth subject!"); } // Create the identification element final AuthIdentification aIdentification = new AuthIdentification (aSubject); // create the token (without expiration seconds) final IAuthToken aNewAuthToken = AuthTokenRegistry.createToken (aIdentification, IAuthToken.EXPIRATION_SECONDS_INFINITE); return AuthIdentificationResult.createSuccess (aNewAuthToken); }
Example #23
Source File: FileIntIDFactory.java From ph-commons with Apache License 2.0 | 5 votes |
public FileIntIDFactory (@Nonnull final File aFile, @Nonnegative final int nReserveCount) { super (nReserveCount); ValueEnforcer.notNull (aFile, "File"); m_aFile = aFile; m_aPrevFile = new File (aFile.getParentFile (), aFile.getName () + ".prev"); m_aNewFile = new File (aFile.getParentFile (), aFile.getName () + ".new"); if (!FileHelper.canReadAndWriteFile (m_aFile)) throw new IllegalArgumentException ("Cannot read and/or write the file " + m_aFile + "!"); if (!FileHelper.canReadAndWriteFile (m_aPrevFile)) throw new IllegalArgumentException ("Cannot read and/or write the file " + m_aPrevFile + "!"); if (!FileHelper.canReadAndWriteFile (m_aNewFile)) throw new IllegalArgumentException ("Cannot read and/or write the file " + m_aNewFile + "!"); if (m_aNewFile.exists ()) throw new IllegalStateException ("The temporary ID file '" + m_aNewFile.getAbsolutePath () + "' already exists! Please use the file with the highest number. Please resolve this conflict manually."); if (m_aPrevFile.exists ()) throw new IllegalStateException ("The temporary ID file '" + m_aPrevFile.getAbsolutePath () + "' already exists! If the ID file '" + m_aFile.getAbsolutePath () + "' exists and contains a higher number, you may consider deleting this file. Please resolve this conflict manually."); }
Example #24
Source File: JsonValueSerializerRegistry.java From ph-commons with Apache License 2.0 | 5 votes |
public void registerJsonValueSerializer (@Nonnull final Class <?> aClass, @Nonnull final IJsonValueSerializer aValueSerializer) { ValueEnforcer.notNull (aClass, "Class"); ValueEnforcer.notNull (aValueSerializer, "ValueSerializer"); m_aRWLock.writeLocked ( () -> { // The class should not already be registered if (m_aMap.containsKey (aClass)) throw new IllegalArgumentException ("An IJsonValueSerializer for class " + aClass + " is already registered!"); // register the class m_aMap.put (aClass, aValueSerializer); }); }
Example #25
Source File: FileHelper.java From ph-commons with Apache License 2.0 | 5 votes |
@Nullable public static NonBlockingBufferedWriter getBufferedWriter (@Nonnull final File aFile, @Nonnull final EAppend eAppend, @Nonnull final Charset aCharset) { ValueEnforcer.notNull (aFile, "File"); ValueEnforcer.notNull (aCharset, "Charset"); final Writer aWriter = getWriter (aFile, eAppend, aCharset); if (aWriter == null) return null; return new NonBlockingBufferedWriter (aWriter); }
Example #26
Source File: XMLFactory.java From ph-commons with Apache License 2.0 | 5 votes |
/** * Create a new {@link DocumentBuilderFactory} for the specified schema, with * the following settings: coalescing, comment ignoring and namespace aware. * * @param aSchema * The schema to use. May not be <code>null</code>. * @return Never <code>null</code>. */ @Nonnull public static DocumentBuilderFactory createDocumentBuilderFactory (@Nonnull final Schema aSchema) { ValueEnforcer.notNull (aSchema, "Schema"); final DocumentBuilderFactory aDocumentBuilderFactory = createDefaultDocumentBuilderFactory (); aDocumentBuilderFactory.setSchema (aSchema); return aDocumentBuilderFactory; }
Example #27
Source File: SchematronResourcePure.java From ph-schematron with Apache License 2.0 | 5 votes |
/** * The main method to convert a node to an SVRL document. * * @param aXMLNode * The source node to be validated. May not be <code>null</code>. * @param sBaseURI * Base URI of the XML document to be validated. May be * <code>null</code>. * @return The SVRL document. Never <code>null</code>. * @throws SchematronException * in case of a sever error validating the schema */ @Nonnull public SchematronOutputType applySchematronValidationToSVRL (@Nonnull final Node aXMLNode, @Nullable final String sBaseURI) throws SchematronException { ValueEnforcer.notNull (aXMLNode, "XMLNode"); final SchematronOutputType aSOT = getOrCreateBoundSchema ().validateComplete (aXMLNode, sBaseURI); // Debug print the created SVRL document if (SchematronDebug.isShowCreatedSVRL ()) LOGGER.info ("Created SVRL:\n" + new SVRLMarshaller (false).getAsString (aSOT)); return aSOT; }
Example #28
Source File: ConfigFileBuilder.java From ph-commons with Apache License 2.0 | 5 votes |
@Nonnull public ConfigFileBuilder setPaths (@Nonnull @Nonempty final Iterable <String> aConfigPaths) { ValueEnforcer.notEmptyNoNullValue (aConfigPaths, "ConfigPaths"); m_aPaths.setAll (aConfigPaths); return this; }
Example #29
Source File: CSSNamespaceRule.java From ph-css with Apache License 2.0 | 5 votes |
@Nonnull public CSSNamespaceRule setNamespaceURL (@Nonnull final String sURL) { ValueEnforcer.notNull (sURL, "URL"); m_sURL = sURL; return this; }
Example #30
Source File: WatchDir.java From ph-commons with Apache License 2.0 | 5 votes |
/** * Creates a WatchService and registers the given directory * * @param aDir * The directory to be watched. May not be <code>null</code>. * @param bRecursive * <code>true</code> to watch the directory recursive, * <code>false</code> to watch just this directory. * @throws IOException * In case something goes wrong. */ public WatchDir (@Nonnull final Path aDir, final boolean bRecursive) throws IOException { ValueEnforcer.notNull (aDir, "Directory"); ValueEnforcer.isTrue (aDir.toFile ().isDirectory (), () -> "Provided path is not a directory: " + aDir); m_aWatcher = FileSystems.getDefault ().newWatchService (); m_aStartDir = aDir.toRealPath (); m_bRecursive = bRecursive; boolean bRegisterRecursiveManually = bRecursive; // Windows only! if (bRecursive && EOperatingSystem.WINDOWS.isCurrentOS ()) { // Reflection, as this is for Windows/Oracle JDK only! // Shortcut for com.sun.nio.file.ExtendedWatchEventModifier.FILE_TREE final Class <?> aClass = GenericReflection.getClassFromNameSafe ("com.sun.nio.file.ExtendedWatchEventModifier"); if (aClass != null) { // Use the special "register recursive" on Windows (enum constant // "FILE_TREE") @SuppressWarnings ("unchecked") final Enum <?> [] aEnumConstants = ((Class <Enum <?>>) aClass).getEnumConstants (); final Enum <?> aFileTree = ArrayHelper.findFirst (aEnumConstants, x -> x.name ().equals ("FILE_TREE")); if (aFileTree != null) { m_aModifiers = new WatchEvent.Modifier [] { (WatchEvent.Modifier) aFileTree }; bRegisterRecursiveManually = false; } } } m_bRegisterRecursiveManually = bRegisterRecursiveManually; if (m_bRegisterRecursiveManually) _registerDirRecursive (m_aStartDir); else _registerDir (m_aStartDir); }