/** The name of the “content type” property. */
public static final String PROPERTY_CONTENT_TYPE = "contentType";
+ /** Whether this entry is virtual. */
+ private final boolean virtual;
+
/** The name of the file. */
private String name;
private String contentType;
/**
+ * Creates a new entry.
+ *
+ * @param virtual
+ * <code>true</code> if this entry is virtual,
+ * <code>false</code> otherwise
+ */
+ protected AbstractEntry(boolean virtual) {
+ this.virtual = virtual;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isVirtual() {
+ return virtual;
+ }
+
+ /**
* {@inheritDoc}
*/
public String getName() {
public interface Entry {
/**
+ * Returns whether this entry denotes a virtual file. A virtual file entry
+ * is a file entry that does not have a corresponding file on the disk.
+ *
+ * @return <code>true</code> if this entry is a virtual file entry,
+ * <code>false</code> otherwise
+ */
+ public boolean isVirtual();
+
+ /**
* Returns the name of the file. The name can contain multiple path
* components, separated by the platform’s {@link File#separatorChar}. It
* will never start with a separator, though.
private String path;
/**
+ * Creates a new entry that represents a physical file on disk.
+ */
+ public PhysicalEntry() {
+ super(false);
+ }
+
+ /**
* Returns the path of the file.
*
* @return The path of the file
private String target;
/**
+ * Creates a new entry that redirects to another URL.
+ */
+ public RedirectEntry() {
+ super(true);
+ }
+
+ /**
* Returns the target of the redirect.
*
* @return The target of the redirect