From: David ‘Bombe’ Roden Date: Mon, 26 May 2008 20:27:20 +0000 (+0200) Subject: add virtual flag in entry X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=95caf3bdb2b7946e4f20a45025f730dd47c5985c;p=jSite2.git add virtual flag in entry --- diff --git a/src/net/pterodactylus/jsite/project/AbstractEntry.java b/src/net/pterodactylus/jsite/project/AbstractEntry.java index 5c3c3bd..4f6e6ed 100644 --- a/src/net/pterodactylus/jsite/project/AbstractEntry.java +++ b/src/net/pterodactylus/jsite/project/AbstractEntry.java @@ -37,6 +37,9 @@ public abstract class AbstractEntry extends AbstractBean implements Entry { /** 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; @@ -47,6 +50,24 @@ public abstract class AbstractEntry extends AbstractBean implements Entry { private String contentType; /** + * Creates a new entry. + * + * @param virtual + * true if this entry is virtual, + * false otherwise + */ + protected AbstractEntry(boolean virtual) { + this.virtual = virtual; + } + + /** + * {@inheritDoc} + */ + public boolean isVirtual() { + return virtual; + } + + /** * {@inheritDoc} */ public String getName() { diff --git a/src/net/pterodactylus/jsite/project/Entry.java b/src/net/pterodactylus/jsite/project/Entry.java index 09d9f39..9b3c521 100644 --- a/src/net/pterodactylus/jsite/project/Entry.java +++ b/src/net/pterodactylus/jsite/project/Entry.java @@ -30,6 +30,15 @@ import java.io.File; 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 true if this entry is a virtual file entry, + * false 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. diff --git a/src/net/pterodactylus/jsite/project/PhysicalEntry.java b/src/net/pterodactylus/jsite/project/PhysicalEntry.java index e56a8a1..6985580 100644 --- a/src/net/pterodactylus/jsite/project/PhysicalEntry.java +++ b/src/net/pterodactylus/jsite/project/PhysicalEntry.java @@ -33,6 +33,13 @@ public class PhysicalEntry extends AbstractEntry { 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 diff --git a/src/net/pterodactylus/jsite/project/RedirectEntry.java b/src/net/pterodactylus/jsite/project/RedirectEntry.java index 36f7bd6..82b2968 100644 --- a/src/net/pterodactylus/jsite/project/RedirectEntry.java +++ b/src/net/pterodactylus/jsite/project/RedirectEntry.java @@ -34,6 +34,13 @@ public class RedirectEntry extends AbstractEntry { 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