Path path = new File("./folder").toPath(); WatchService watchService = FileSystems.getDefault().newWatchService(); path.register(watchService, StandardWatchEventKinds.ENTRY_CREATE); for (;;) { try { WatchKey key = watchService.take(); for (WatchEvent<?> event : key.pollEvents()) { WatchEvent.Kind<?> kind = event.kind(); if (kind.equals(StandardWatchEventKinds.ENTRY_CREATE)) { System.out.println("file created"); } } } catch (InterruptedException x) { return; } }
final Kind baseValue = baseValues[ i ] ; final Kind extendingValue = extendingValues[ i ] ; if( baseValue.ordinal() != extendingValue.ordinal() ) { throw new IncorrectExtensionError( "Base ordinal " + baseValue.ordinal() + " doesn't match with " + extendingValue.ordinal() ) ; if( ! baseValue.name().equals( extendingValue.name() ) ) { throw new IncorrectExtensionError( "Base name[ " + i + "] " + baseValue.name() + " doesn't match with " + extendingValue.name() ) ; if( ! baseValue.description().equals( extendingValue.description() ) ) { throw new IncorrectExtensionError( "Description[ " + i + "] " + baseValue.description() + " doesn't match with " + extendingValue.description() ) ;
Path fileName = ev.context(); System.out.println(kind.name() + ": " + fileName);
switch (kind.name()) { case "ENTRY_CREATE": System.out.println("Creation has been detected in " + getDirName());
sb.append(kind.name().toLowerCase()).append(SPACE); sb.append(name);
public boolean equals(Object o){ if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; TypeDefFluentImpl that = (TypeDefFluentImpl) o; if (kind != null ? !kind.equals(that.kind) :that.kind != null) return false; if (packageName != null ? !packageName.equals(that.packageName) :that.packageName != null) return false; if (name != null ? !name.equals(that.name) :that.name != null) return false; if (comments != null ? !comments.equals(that.comments) :that.comments != null) return false; if (annotations != null ? !annotations.equals(that.annotations) :that.annotations != null) return false; if (extendsList != null ? !extendsList.equals(that.extendsList) :that.extendsList != null) return false; if (implementsList != null ? !implementsList.equals(that.implementsList) :that.implementsList != null) return false; if (parameters != null ? !parameters.equals(that.parameters) :that.parameters != null) return false; if (properties != null ? !properties.equals(that.properties) :that.properties != null) return false; if (constructors != null ? !constructors.equals(that.constructors) :that.constructors != null) return false; if (methods != null ? !methods.equals(that.methods) :that.methods != null) return false; if (outerType != null ? !outerType.equals(that.outerType) :that.outerType != null) return false; if (innerTypes != null ? !innerTypes.equals(that.innerTypes) :that.innerTypes != null) return false; return true; }