@Override
public int compare(Artist leftArtist, Artist rightArtist) {
- return leftArtist.name().compareToIgnoreCase(rightArtist.name());
+ return leftArtist.getName().compareToIgnoreCase(rightArtist.getName());
}
});
@Override
public int compare(Track leftTrack, Track rightTrack) {
- return leftTrack.name().compareToIgnoreCase(rightTrack.name());
+ return leftTrack.getName().compareToIgnoreCase(rightTrack.getName());
}
});
@Override
public int compare(Style leftStyle, Style rightStyle) {
- return leftStyle.name().compareToIgnoreCase(rightStyle.name());
+ return leftStyle.getName().compareToIgnoreCase(rightStyle.getName());
}
});
*/
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);
}
*/
public interface Base {
- public String id();
+ public String getId();
}
@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;
}
@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;
}
* {@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();
}
}
*/
@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"));
}
}
@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;
}
* {@inheritDoc}
*/
@Override
- public Collection<Artist> artists() {
+ public Collection<Artist> getArtists() {
artistsMemoizer.get();
- return super.artists();
+ return super.getArtists();
}
}
*/
@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"));
}
}
@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;
}
@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;
}
* {@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();
}
}
*/
@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"));
}
}
*/
@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"));
}
}
}
@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;
}
*/
@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;
}
this.id = id;
}
- public String id() {
@Override
+ public String getId() {
return id;
}
}
@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;
}
}
*/
@Override
public int hashCode() {
- return id().hashCode();
+ return getId().hashCode();
}
/**
if (!(obj instanceof Base)) {
return false;
}
- return id().equals(((Base) obj).id());
+ return getId().equals(((Base) obj).getId());
}
/**
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());
}
return this;
}
- public boolean dirty() {
+ public boolean isDirty() {
return (original != null) ? !original.equals(current) : current != null;
}
* {@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;
}
* {@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;
}
*/
@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;
}
}
@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;
}
}
@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;
}
}
@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;
}
*/
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);
}
*/
public interface Party extends Base {
- public String name();
+ public String getName();
- public Party name(String name);
+ public Party setName(String name);
}
*/
public interface Style extends Base {
- public String name();
+ public String getName();
- public Style name(String name);
+ public Style setName(String name);
}
*/
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);
}