1 /* 2 * aTunes 3 * Copyright (C) Alex Aranda, Sylvain Gaudard and contributors 4 * 5 * See http://www.atunes.org/wiki/index.php?title=Contributing for information about contributors 6 * 7 * http://www.atunes.org 8 * http://sourceforge.net/projects/atunes 9 * 10 * This program is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU General Public License 12 * as published by the Free Software Foundation; either version 2 13 * of the License, or (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 */ 20 21 package net.sourceforge.atunes.kernel.modules.webservices.lyrics; 22 23 import java.beans.ConstructorProperties; 24 25 import net.sourceforge.atunes.model.ILyricsEngineInfo; 26 27 import org.apache.commons.lang.builder.ReflectionToStringBuilder; 28 import org.apache.commons.lang.builder.ToStringStyle; 29 30 /** 31 * Class with info about lyrics engines. 32 */ 33 public class LyricsEngineInfo implements ILyricsEngineInfo { 34 35 private static final long serialVersionUID = -8014747196952195246L; 36 37 private final String name; 38 private final String clazz; 39 private boolean enabled; 40 41 /** 42 * @param name 43 * @param clazz 44 * @param enabled 45 */ 46 @ConstructorProperties({ "name", "clazz", "enabled" }) LyricsEngineInfo(final String name, final String clazz, final boolean enabled)47 public LyricsEngineInfo(final String name, final String clazz, 48 final boolean enabled) { 49 this.enabled = enabled; 50 this.clazz = clazz; 51 this.name = name; 52 } 53 54 @Override getName()55 public String getName() { 56 return this.name; 57 } 58 59 @Override getClazz()60 public String getClazz() { 61 return this.clazz; 62 } 63 64 @Override isEnabled()65 public boolean isEnabled() { 66 return this.enabled; 67 } 68 69 @Override setEnabled(final boolean enabled)70 public void setEnabled(final boolean enabled) { 71 this.enabled = enabled; 72 } 73 74 @Override hashCode()75 public int hashCode() { 76 final int prime = 31; 77 int result = 1; 78 result = prime * result 79 + ((this.clazz == null) ? 0 : this.clazz.hashCode()); 80 return result; 81 } 82 83 @Override equals(final Object obj)84 public boolean equals(final Object obj) { 85 if (this == obj) { 86 return true; 87 } 88 if (obj == null) { 89 return false; 90 } 91 if (getClass() != obj.getClass()) { 92 return false; 93 } 94 LyricsEngineInfo other = (LyricsEngineInfo) obj; 95 if (this.clazz == null) { 96 if (other.clazz != null) { 97 return false; 98 } 99 } else if (!this.clazz.equals(other.clazz)) { 100 return false; 101 } 102 return true; 103 } 104 105 @Override copy()106 public ILyricsEngineInfo copy() { 107 return new LyricsEngineInfo(getName(), getClazz(), isEnabled()); 108 } 109 110 @Override toString()111 public String toString() { 112 return ReflectionToStringBuilder.toString(this, 113 ToStringStyle.SHORT_PREFIX_STYLE); 114 } 115 116 } 117