package com.socotech.sitemap;

import com.google.common.base.Preconditions;

/**
 * User: marc Date: Jan 13, 2009 Time: 8:09:08 AM
 */
public class SitemapEntry {
    private String url;
    private float priority;
    private ChangeFrequency changeFrequency;

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public float getPriority() {
        return priority;
    }

    public void setPriority(float f) {
        this.priority = f;
    }

    public ChangeFrequency getChangeFrequency() {
        return changeFrequency;
    }

    public void setChangeFrequency(ChangeFrequency frequency) {
        this.changeFrequency = frequency;
    }

    public static SitemapEntry newSitemapEntry(String url) {
        return newSitemapEntry(url, 1.0f, ChangeFrequency.never);
    }

    public static SitemapEntry newSitemapEntry(String url, ChangeFrequency frequency) {
        return newSitemapEntry(url, 1.0f, frequency);
    }

    public static SitemapEntry newSitemapEntry(String url, float priority, ChangeFrequency frequency) {
        Preconditions.checkNotNull(url, "URL is null");
        Preconditions.checkNotNull(frequency, "ChangeFrequency is null");
        Preconditions.checkState(priority >= 0.0f && priority <= 1.0f);
        SitemapEntry impl = new SitemapEntry();
        impl.setUrl(url);
        impl.setPriority(priority);
        impl.setChangeFrequency(frequency);
        return impl;
    }
}

@@ -70,16 +70,100 @@
 tions;%0A%0A
+import java.text.SimpleDateFormat;%0Aimport java.util.Date;%0Aimport java.util.Locale;%0A%0A
 /**%0A * U
@@ -239,16 +239,48 @@
 pEntry %7B
+%0A%0A    private Date lastModified;
 %0A    pri
@@ -624,32 +624,206 @@
 ity = f;%0A    %7D%0A%0A
+    public Date getLastModified() %7B%0A        return lastModified;%0A    %7D%0A%0A    public void setLastModified(Date lastModified) %7B%0A        this.lastModified = lastModified;%0A    %7D%0A%0A
     public Chang
@@ -1000,32 +1000,1227 @@
 equency;%0A    %7D%0A%0A
+    public String getLastModifiedAsString() %7B%0A        return new SimpleDateFormat(%22yyyy-MM-dd%22, Locale.getDefault()).format(lastModified);%0A    %7D%0A%0A    static public class Builder %7B%0A%0A        private SitemapEntry entry;%0A%0A        public Builder() %7B%0A            this.entry = new SitemapEntry();%0A            this.entry.setPriority(0.5f);%0A        %7D%0A%0A        public Builder url(String url) %7B%0A            Preconditions.checkNotNull(url, %22URL is null%22);%0A            this.entry.setUrl(url);%0A            return this;%0A        %7D%0A%0A        public Builder priority(float priority) %7B%0A            Preconditions.checkState(priority %3E= 0.0f && priority %3C= 1.0f);%0A            this.entry.setPriority(priority);%0A            return this;%0A        %7D%0A%0A        public Builder lastModified(Date date) %7B%0A            this.entry.setLastModified(date);%0A            return this;%0A        %7D%0A%0A        public Builder changeFrequency(ChangeFrequency frequency) %7B%0A            Preconditions.checkNotNull(frequency, %22ChangeFrequency cannot be null%22);%0A            this.entry.setChangeFrequency(frequency);%0A            return this;%0A        %7D%0A%0A        public SitemapEntry build() %7B%0A            return entry;%0A        %7D%0A    %7D%0A%0A    @Deprecated%0A
     public stati
@@ -2329,32 +2329,48 @@
 .never);%0A    %7D%0A%0A
+    @Deprecated%0A
     public stati
@@ -2494,32 +2494,48 @@
 quency);%0A    %7D%0A%0A
+    @Deprecated%0A
     public stati
@@ -2999,16 +2999,17 @@
 n impl;%0A
-
     %7D%0A
+%0A
 %7D%0A

converted sitemap to XML