package net.brutex.xservices.types; import java.io.File; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; @XmlRootElement public class FileInfoType { private String name; private String path; private long filesize; private boolean canWrite; private boolean isDirectory; public FileInfoType() { } public FileInfoType(File file) { this.name = file.getName(); this.path = file.getAbsolutePath().replace('\\', '/'); this.canWrite = file.canWrite(); this.filesize = file.length(); this.isDirectory = file.isDirectory(); } /** * @return the name */ @XmlElement(name="name") public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the path */ @XmlElement(name="path") public String getPath() { return path; } /** * @param path the path to set */ public void setPath(String path) { this.path = path; } /** * @return the filesize */ @XmlElement(name="size") public long getFilesize() { return filesize; } /** * @param filesize the filesize to set */ public void setFilesize(long filesize) { this.filesize = filesize; } /** * @return the canWrite */ @XmlElement(name="isWritable") public boolean isCanWrite() { return canWrite; } /** * @return the isDirectory */ @XmlElement(name="isDirectory") public boolean isDirectory() { return isDirectory; } }