From 95caf3bdb2b7946e4f20a45025f730dd47c5985c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 26 May 2008 22:27:20 +0200 Subject: [PATCH] add virtual flag in entry --- .../pterodactylus/jsite/project/AbstractEntry.java | 21 +++++++++++++++++++++ src/net/pterodactylus/jsite/project/Entry.java | 9 +++++++++ .../pterodactylus/jsite/project/PhysicalEntry.java | 7 +++++++ .../pterodactylus/jsite/project/RedirectEntry.java | 7 +++++++ 4 files changed, 44 insertions(+) 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 -- 2.7.4