Revert to using Java default getter and setter names.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 25 Apr 2012 13:12:37 +0000 (15:12 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 25 Apr 2012 13:12:37 +0000 (15:12 +0200)
14 files changed:
src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java
src/main/java/net/pterodactylus/demoscenemusic/data/Artist.java
src/main/java/net/pterodactylus/demoscenemusic/data/Base.java
src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java
src/main/java/net/pterodactylus/demoscenemusic/data/DefaultArtist.java
src/main/java/net/pterodactylus/demoscenemusic/data/DefaultBase.java
src/main/java/net/pterodactylus/demoscenemusic/data/DefaultGroup.java
src/main/java/net/pterodactylus/demoscenemusic/data/DefaultParty.java
src/main/java/net/pterodactylus/demoscenemusic/data/DefaultStyle.java
src/main/java/net/pterodactylus/demoscenemusic/data/DefaultTrack.java
src/main/java/net/pterodactylus/demoscenemusic/data/Group.java
src/main/java/net/pterodactylus/demoscenemusic/data/Party.java
src/main/java/net/pterodactylus/demoscenemusic/data/Style.java
src/main/java/net/pterodactylus/demoscenemusic/data/Track.java

index acbb034..c0edf44 100644 (file)
@@ -86,7 +86,7 @@ public class TemplateServlet extends HttpServlet {
 
                        @Override
                        public int compare(Artist leftArtist, Artist rightArtist) {
-                               return leftArtist.name().compareToIgnoreCase(rightArtist.name());
+                               return leftArtist.getName().compareToIgnoreCase(rightArtist.getName());
                        }
 
                });
@@ -94,7 +94,7 @@ public class TemplateServlet extends HttpServlet {
 
                        @Override
                        public int compare(Track leftTrack, Track rightTrack) {
-                               return leftTrack.name().compareToIgnoreCase(rightTrack.name());
+                               return leftTrack.getName().compareToIgnoreCase(rightTrack.getName());
                        }
 
                });
@@ -102,7 +102,7 @@ public class TemplateServlet extends HttpServlet {
 
                        @Override
                        public int compare(Style leftStyle, Style rightStyle) {
-                               return leftStyle.name().compareToIgnoreCase(rightStyle.name());
+                               return leftStyle.getName().compareToIgnoreCase(rightStyle.getName());
                        }
 
                });
index f0948da..d9e6682 100644 (file)
@@ -26,16 +26,16 @@ import java.util.Collection;
  */
 public interface Artist extends Base {
 
-       public String name();
+       public String getName();
 
-       public Artist name(String name);
+       public Artist setName(String name);
 
-       public Collection<Group> groups();
+       public Collection<Group> getGroups();
 
-       public Artist groups(Collection<Group> groups);
+       public Artist setGroups(Collection<Group> groups);
 
-       public Collection<Track> tracks();
+       public Collection<Track> getTracks();
 
-       public Artist tracks(Collection<Track> tracks);
+       public Artist setTracks(Collection<Track> tracks);
 
 }
index 7a36493..921ca30 100644 (file)
@@ -25,6 +25,6 @@ package net.pterodactylus.demoscenemusic.data;
  */
 public interface Base {
 
-       public String id();
+       public String getId();
 
 }
index 06cfccc..ef3c151 100644 (file)
@@ -122,7 +122,7 @@ public class DataManager {
                        @Override
                        public Void call() throws DatabaseException {
                                if (!hasValue("tracks")) {
-                                       value("tracks", Collection.class).set(getTracksByArtist(id()));
+                                       getValue("tracks", Collection.class).set(getTracksByArtist(getId()));
                                }
                                return null;
                        }
@@ -133,7 +133,7 @@ public class DataManager {
                        @Override
                        public Void call() throws Exception {
                                if (!hasValue("groups")) {
-                                       value("groups", Collection.class).set(getGroupsByArtist(id()));
+                                       getValue("groups", Collection.class).set(getGroupsByArtist(getId()));
                                }
                                return null;
                        }
@@ -148,15 +148,15 @@ public class DataManager {
                 * {@inheritDoc}
                 */
                @Override
-               public Collection<Group> groups() {
+               public Collection<Group> getGroups() {
                        groupsMemoizer.get();
-                       return super.groups();
+                       return super.getGroups();
                }
 
                @Override
-               public Collection<Track> tracks() {
+               public Collection<Track> getTracks() {
                        tracksMemoizer.get();
-                       return super.tracks();
+                       return super.getTracks();
                }
 
        }
@@ -168,7 +168,7 @@ public class DataManager {
                 */
                @Override
                public Artist createObject(ResultSet resultSet) throws SQLException {
-                       return new LazyArtist(resultSet.getString("ARTISTS.ID")).name(resultSet.getString("ARTISTS.NAME"));
+                       return new LazyArtist(resultSet.getString("ARTISTS.ID")).setName(resultSet.getString("ARTISTS.NAME"));
                }
 
        }
@@ -180,7 +180,7 @@ public class DataManager {
                        @Override
                        public Void call() throws Exception {
                                if (!hasValue("artists")) {
-                                       value("artists", Collection.class).set(getArtistsByGroup(id()));
+                                       getValue("artists", Collection.class).set(getArtistsByGroup(getId()));
                                }
                                return null;
                        }
@@ -195,9 +195,9 @@ public class DataManager {
                 * {@inheritDoc}
                 */
                @Override
-               public Collection<Artist> artists() {
+               public Collection<Artist> getArtists() {
                        artistsMemoizer.get();
-                       return super.artists();
+                       return super.getArtists();
                }
 
        }
@@ -209,7 +209,7 @@ public class DataManager {
                 */
                @Override
                public Group createObject(ResultSet resultSet) throws SQLException {
-                       return new LazyGroup(resultSet.getString("GROUPS.ID")).name(resultSet.getString("GROUPS.NAME")).url(resultSet.getString("GROUPS.URL"));
+                       return new LazyGroup(resultSet.getString("GROUPS.ID")).setName(resultSet.getString("GROUPS.NAME")).setUrl(resultSet.getString("GROUPS.URL"));
                }
 
        }
@@ -221,7 +221,7 @@ public class DataManager {
                        @Override
                        public Void call() throws Exception {
                                if (!hasValue("artists")) {
-                                       value("artists", List.class).set(getArtistsByTrack(id()));
+                                       getValue("artists", List.class).set(getArtistsByTrack(getId()));
                                }
                                return null;
                        }
@@ -233,7 +233,7 @@ public class DataManager {
                        @Override
                        public Void call() throws Exception {
                                if (!hasValue("styles")) {
-                                       value("styles", Collection.class).set(getStylesByTrack(id()));
+                                       getValue("styles", Collection.class).set(getStylesByTrack(getId()));
                                }
                                return null;
                        }
@@ -251,18 +251,18 @@ public class DataManager {
                 * {@inheritDoc}
                 */
                @Override
-               public List<Artist> artists() {
+               public List<Artist> getArtists() {
                        artistsMemoizer.get();
-                       return super.artists();
+                       return super.getArtists();
                }
 
                /**
                 * {@inheritDoc}
                 */
                @Override
-               public Collection<Style> styles() {
+               public Collection<Style> getStyles() {
                        stylesMemoizer.get();
-                       return super.styles();
+                       return super.getStyles();
                }
 
        }
@@ -274,7 +274,7 @@ public class DataManager {
                 */
                @Override
                public Track createObject(ResultSet resultSet) throws SQLException {
-                       return new LazyTrack(resultSet.getString("TRACKS.ID")).name(resultSet.getString("TRACKS.NAME"));
+                       return new LazyTrack(resultSet.getString("TRACKS.ID")).setName(resultSet.getString("TRACKS.NAME"));
                }
 
        }
@@ -286,7 +286,7 @@ public class DataManager {
                 */
                @Override
                public Style createObject(ResultSet resultSet) throws SQLException {
-                       return new DefaultStyle(resultSet.getString("STYLES.ID")).name(resultSet.getString("STYLES.NAME"));
+                       return new DefaultStyle(resultSet.getString("STYLES.ID")).setName(resultSet.getString("STYLES.NAME"));
                }
 
        }
index c739275..3dc0108 100644 (file)
@@ -31,13 +31,13 @@ public class DefaultArtist extends DefaultBase implements Artist {
        }
 
        @Override
-       public String name() {
-               return value("name", String.class).get();
+       public String getName() {
+               return getValue("name", String.class).get();
        }
 
        @Override
-       public Artist name(String name) {
-               value("name", String.class).set(name);
+       public Artist setName(String name) {
+               getValue("name", String.class).set(name);
                return this;
        }
 
@@ -46,27 +46,27 @@ public class DefaultArtist extends DefaultBase implements Artist {
         */
        @Override
        @SuppressWarnings("unchecked")
-       public Collection<Group> groups() {
-               return value("groups", Collection.class).get();
+       public Collection<Group> getGroups() {
+               return getValue("groups", Collection.class).get();
        }
 
        /**
         * {@inheritDoc}
         */
        @Override
-       public Artist groups(Collection<Group> groups) {
-               value("groups", Collection.class).set(groups);
+       public Artist setGroups(Collection<Group> groups) {
+               getValue("groups", Collection.class).set(groups);
                return this;
        }
 
        @Override
-       public Collection<Track> tracks() {
-               return value("tracks", Collection.class).get();
+       public Collection<Track> getTracks() {
+               return getValue("tracks", Collection.class).get();
        }
 
        @Override
-       public Artist tracks(Collection<Track> tracks) {
-               value("tracks", Collection.class).set(tracks);
+       public Artist setTracks(Collection<Track> tracks) {
+               getValue("tracks", Collection.class).set(tracks);
                return this;
        }
 
index 589ba86..577de49 100644 (file)
@@ -36,8 +36,8 @@ public class DefaultBase implements Base {
                this.id = id;
        }
 
-       public String id() {
        @Override
+       public String getId() {
                return id;
        }
 
@@ -46,16 +46,16 @@ public class DefaultBase implements Base {
        }
 
        @SuppressWarnings({ "synthetic-access", "unchecked" })
-       protected <T> Value<T> value(String name, Class<T> clazz) {
+       protected <T> Value<T> getValue(String name, Class<T> clazz) {
                if (!attributes.containsKey(name)) {
                        attributes.put(name, new Value<T>());
                }
                return (Value<T>) attributes.get(name);
        }
 
-       protected boolean dirty() {
+       protected boolean isDirty() {
                for (Value<?> value : attributes.values()) {
-                       if (value.dirty()) {
+                       if (value.isDirty()) {
                                return true;
                        }
                }
@@ -71,7 +71,7 @@ public class DefaultBase implements Base {
         */
        @Override
        public int hashCode() {
-               return id().hashCode();
+               return getId().hashCode();
        }
 
        /**
@@ -82,7 +82,7 @@ public class DefaultBase implements Base {
                if (!(obj instanceof Base)) {
                        return false;
                }
-               return id().equals(((Base) obj).id());
+               return getId().equals(((Base) obj).getId());
        }
 
        /**
@@ -92,7 +92,7 @@ public class DefaultBase implements Base {
        public String toString() {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.append(getClass().getName());
-               stringBuilder.append('[').append("id=").append(id());
+               stringBuilder.append('[').append("id=").append(getId());
                for (Entry<String, Value<?>> attributeEntry : attributes.entrySet()) {
                        stringBuilder.append(',').append(attributeEntry.getKey()).append('=').append(attributeEntry.getValue().get());
                }
@@ -121,7 +121,7 @@ public class DefaultBase implements Base {
                        return this;
                }
 
-               public boolean dirty() {
+               public boolean isDirty() {
                        return (original != null) ? !original.equals(current) : current != null;
                }
 
index 16b2cca..aae28e3 100644 (file)
@@ -34,16 +34,16 @@ public class DefaultGroup extends DefaultBase implements Group {
         * {@inheritDoc}
         */
        @Override
-       public String name() {
-               return value("name", String.class).get();
+       public String getName() {
+               return getValue("name", String.class).get();
        }
 
        /**
         * {@inheritDoc}
         */
        @Override
-       public Group name(String name) {
-               value("name", String.class).set(name);
+       public Group setName(String name) {
+               getValue("name", String.class).set(name);
                return this;
        }
 
@@ -51,16 +51,16 @@ public class DefaultGroup extends DefaultBase implements Group {
         * {@inheritDoc}
         */
        @Override
-       public String url() {
-               return value("url", String.class).get();
+       public String getUrl() {
+               return getValue("url", String.class).get();
        }
 
        /**
         * {@inheritDoc}
         */
        @Override
-       public Group url(String url) {
-               value("url", String.class).set(url);
+       public Group setUrl(String url) {
+               getValue("url", String.class).set(url);
                return this;
        }
 
@@ -69,16 +69,16 @@ public class DefaultGroup extends DefaultBase implements Group {
         */
        @Override
        @SuppressWarnings("unchecked")
-       public Collection<Artist> artists() {
-               return value("artists", Collection.class).get();
+       public Collection<Artist> getArtists() {
+               return getValue("artists", Collection.class).get();
        }
 
        /**
         * {@inheritDoc}
         */
        @Override
-       public Group artists(Collection<Artist> artists) {
-               value("artists", Collection.class).set(artists);
+       public Group setArtists(Collection<Artist> artists) {
+               getValue("artists", Collection.class).set(artists);
                return this;
        }
 
index dd684b3..f30a42f 100644 (file)
@@ -29,13 +29,13 @@ public class DefaultParty extends DefaultBase implements Party {
        }
 
        @Override
-       public String name() {
-               return value("name", String.class).get();
+       public String getName() {
+               return getValue("name", String.class).get();
        }
 
        @Override
-       public DefaultParty name(String name) {
-               value("name", String.class).set(name);
+       public DefaultParty setName(String name) {
+               getValue("name", String.class).set(name);
                return this;
        }
 
index 50b489f..19995e2 100644 (file)
@@ -29,13 +29,13 @@ public class DefaultStyle extends DefaultBase implements Style {
        }
 
        @Override
-       public String name() {
-               return value("name", String.class).get();
+       public String getName() {
+               return getValue("name", String.class).get();
        }
 
        @Override
-       public Style name(String name) {
-               value("name", String.class).set(name);
+       public Style setName(String name) {
+               getValue("name", String.class).set(name);
                return this;
        }
 
index db358f8..7436c4d 100644 (file)
@@ -32,35 +32,35 @@ public class DefaultTrack extends DefaultBase implements Track {
        }
 
        @Override
-       public String name() {
-               return value("name", String.class).get();
+       public String getName() {
+               return getValue("name", String.class).get();
        }
 
        @Override
-       public Track name(String name) {
-               value("name", String.class).set(name);
+       public Track setName(String name) {
+               getValue("name", String.class).set(name);
                return this;
        }
 
        @Override
-       public List<Artist> artists() {
-               return value("artists", List.class).get();
+       public List<Artist> getArtists() {
+               return getValue("artists", List.class).get();
        }
 
        @Override
-       public Track artists(List<Artist> artists) {
-               value("artists", List.class).set(artists);
+       public Track setArtists(List<Artist> artists) {
+               getValue("artists", List.class).set(artists);
                return this;
        }
 
        @Override
-       public Collection<Style> styles() {
-               return value("styles", Collection.class).get();
+       public Collection<Style> getStyles() {
+               return getValue("styles", Collection.class).get();
        }
 
        @Override
-       public Track styles(Collection<? extends Style> styles) {
-               value("styles", Collection.class).set(styles);
+       public Track setStyles(Collection<? extends Style> styles) {
+               getValue("styles", Collection.class).set(styles);
                return this;
        }
 
index 5f135f9..bba8866 100644 (file)
@@ -26,16 +26,16 @@ import java.util.Collection;
  */
 public interface Group extends Base {
 
-       public String name();
+       public String getName();
 
-       public Group name(String name);
+       public Group setName(String name);
 
-       public String url();
+       public String getUrl();
 
-       public Group url(String url);
+       public Group setUrl(String url);
 
-       public Collection<Artist> artists();
+       public Collection<Artist> getArtists();
 
-       public Group artists(Collection<Artist> artists);
+       public Group setArtists(Collection<Artist> artists);
 
 }
index 22697a4..4e2e93b 100644 (file)
@@ -25,8 +25,8 @@ package net.pterodactylus.demoscenemusic.data;
  */
 public interface Party extends Base {
 
-       public String name();
+       public String getName();
 
-       public Party name(String name);
+       public Party setName(String name);
 
 }
index a7a0e16..6f572eb 100644 (file)
@@ -24,8 +24,8 @@ package net.pterodactylus.demoscenemusic.data;
  */
 public interface Style extends Base {
 
-       public String name();
+       public String getName();
 
-       public Style name(String name);
+       public Style setName(String name);
 
 }
index cc1a1c9..ace6bd3 100644 (file)
@@ -27,16 +27,16 @@ import java.util.List;
  */
 public interface Track extends Base {
 
-       public String name();
+       public String getName();
 
-       public Track name(String name);
+       public Track setName(String name);
 
-       public List<Artist> artists();
+       public List<Artist> getArtists();
 
-       public Track artists(List<Artist> artists);
+       public Track setArtists(List<Artist> artists);
 
-       public Collection<Style> styles();
+       public Collection<Style> getStyles();
 
-       public Track styles(Collection<? extends Style> styles);
+       public Track setStyles(Collection<? extends Style> styles);
 
 }