DFile implements Serializable, Comparable<DFile> { public Map<String, Object> toMap(){ if(getUploadDate()==null) setUploadDate(new Date()); Map<String,Object> map=new HashMap<>(); FieldAccess access=FieldAccess.get(this.getClass()); for (String fn : access.getFieldNames()) { map.put(fn, access.get(this, fn)); } map.remove("inputStream"); map.remove("exist"); return map; } DFile();  DFile(String os,InputStream is);  DFile(boolean isDirectory, String parent, String name, long length, InputStream is); static final DFile noExist(); static DFile parse(final File file); static DFile parse(String filePath); Map<String, Object> toMap(); InputStream getInputStream(); long length(); boolean isRoot(); void moveToDir(String targetDir); boolean isFile(); boolean isDirectory(); boolean exist(); String getAbsolutePath(); String getParent(); @Override int compareTo(DFile o); String getOs(); String getCategory(); DFile setCategory(String category); String getMd5(); DFile setMd5(String md5); String getSuffix(); DFile setSuffix(String suffix); String getFilename(); DFile setFilename(String filename); long getLength(); DFile setLength(long length); DFile setParent(String parent); DFile setDirectory(boolean directory); boolean isExist(); DFile setExist(boolean exist); String getPath(); DFile setPath(String path); String getHostname(); DFile setHostname(String hostname); String getContentType(); DFile setContentType(String contentType); String getAuthor(); DFile setAuthor(String author); Date getCreateDate(); DFile setCreateDate(Date createDate); Date getModifyDate(); DFile setModifyDate(Date modifyDate); Date getAccessDate(); DFile setAccessDate(Date accessDate); Date getUploadDate(); DFile setUploadDate(Date uploadDate); String getRemark(); DFile setRemark(String remark); Map<String, Object> getMetadata(); DFile setMetadata(Map<String, Object> metadata); static final String OS; static final boolean IS_WIN; static final String ATTR_DIRECTORY; static final String ATTR_MD5; static final String ATTR_PARENT; static final String ATTR_NAME; static final String ATTR_FILE_NAME; static final String ATTR_PATH; static final String ATTR_HOSTNAME; static final String ATTR_SUFFIX; static final String ATTR_OS; static final String separator; }
@Test public void toMap(){ DFile dFile=DFile.parse("D:\\numbers.txt"); System.out.println(dFile.toMap()); }