1 19 20 package org.netbeans.modules.masterfs.filebasedfs.naming; 21 22 23 import java.io.File ; 24 import java.util.Map ; 25 import java.util.WeakHashMap ; 26 27 30 public class FolderName extends FileName { 31 private static Map fileCache = new WeakHashMap (); 32 33 34 FolderName(final FileNaming parent, final File file) { 35 super(parent, file); 36 synchronized (FolderName.class) { 37 FolderName.fileCache.put(this, file); 38 } 39 } 40 41 42 public File getFile() { 43 File retValue; 44 synchronized (FolderName.class) { 45 retValue = (File ) FolderName.fileCache.get(this); 46 47 if (retValue == null) { 48 retValue = super.getFile(); 49 FolderName.fileCache.put(this, retValue); 50 } 51 } 52 53 assert retValue != null; 54 return retValue; 55 } 56 57 static void freeCaches() { 58 synchronized (FolderName.class) { 59 FolderName.fileCache = new WeakHashMap (); 60 } 61 62 } 63 64 public boolean isFile() { 65 return false; 66 } 67 68 } | Popular Tags |