more generics and missing serialVersionUIDs added

This commit is contained in:
Martin Kurz 2013-10-04 16:04:35 +02:00
parent 0fb698ee99
commit 77c50c516b
37 changed files with 119 additions and 91 deletions

View file

@ -31,7 +31,7 @@ public interface CopyFrom<T> {
* *
* @return the interface the copyFrom works on. * @return the interface the copyFrom works on.
*/ */
public Class<? extends CopyFrom<?>> getInterface(); public Class<? extends CopyFrom<T>> getInterface();
/** /**
* Copies all the properties of the given bean into this one. * Copies all the properties of the given bean into this one.
@ -46,6 +46,6 @@ public interface CopyFrom<T> {
* @param obj the instance to copy properties from. * @param obj the instance to copy properties from.
* *
*/ */
public void copyFrom(CopyFrom<?> obj); public void copyFrom(CopyFrom<T> obj);
} }

View file

@ -43,6 +43,7 @@ import com.sun.syndication.feed.module.impl.ModuleUtils;
* *
*/ */
public abstract class WireFeed implements Cloneable, Serializable, Extendable { public abstract class WireFeed implements Cloneable, Serializable, Extendable {
private static final long serialVersionUID = -3608120400805691829L;
private final ObjectBean objBean; private final ObjectBean objBean;
private String feedType; private String feedType;
private String encoding; private String encoding;

View file

@ -27,6 +27,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* @author Dave Johnson (added for Atom 1.0) * @author Dave Johnson (added for Atom 1.0)
*/ */
public class Category implements Cloneable, Serializable { public class Category implements Cloneable, Serializable {
private static final long serialVersionUID = -2034251366664065410L;
private final ObjectBean objBean; private final ObjectBean objBean;

View file

@ -30,6 +30,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* @author Dave Johnson (updated for Atom 1.0) * @author Dave Johnson (updated for Atom 1.0)
*/ */
public class Content implements Cloneable, Serializable { public class Content implements Cloneable, Serializable {
private static final long serialVersionUID = 2036205883043031310L;
private final ObjectBean objBean; private final ObjectBean objBean;

View file

@ -28,6 +28,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* *
*/ */
public class Generator implements Cloneable, Serializable { public class Generator implements Cloneable, Serializable {
private static final long serialVersionUID = -1457065669831041059L;
private final ObjectBean objBean; private final ObjectBean objBean;
private String url; private String url;
private String version; private String version;

View file

@ -28,6 +28,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* @author Dave Johnson (updated for Atom 1.0) * @author Dave Johnson (updated for Atom 1.0)
*/ */
public class Link implements Cloneable, Serializable { public class Link implements Cloneable, Serializable {
private static final long serialVersionUID = 670365139518027828L;
private final ObjectBean objBean; private final ObjectBean objBean;

View file

@ -41,10 +41,10 @@ import java.util.Set;
*/ */
public class BeanIntrospector { public class BeanIntrospector {
private static final Map introspected = new HashMap(); private static final Map<Class<?>, PropertyDescriptor[]> introspected = new HashMap<Class<?>, PropertyDescriptor[]>();
public static synchronized PropertyDescriptor[] getPropertyDescriptors(final Class klass) throws IntrospectionException { public static synchronized PropertyDescriptor[] getPropertyDescriptors(final Class<?> klass) throws IntrospectionException {
PropertyDescriptor[] descriptors = (PropertyDescriptor[]) introspected.get(klass); PropertyDescriptor[] descriptors = introspected.get(klass);
if (descriptors == null) { if (descriptors == null) {
descriptors = getPDs(klass); descriptors = getPDs(klass);
introspected.put(klass, descriptors); introspected.put(klass, descriptors);
@ -52,11 +52,11 @@ public class BeanIntrospector {
return descriptors; return descriptors;
} }
private static PropertyDescriptor[] getPDs(final Class klass) throws IntrospectionException { private static PropertyDescriptor[] getPDs(final Class<?> klass) throws IntrospectionException {
final Method[] methods = klass.getMethods(); final Method[] methods = klass.getMethods();
final Map getters = getPDs(methods, false); final Map<String, PropertyDescriptor> getters = getPDs(methods, false);
final Map setters = getPDs(methods, true); final Map<String, PropertyDescriptor> setters = getPDs(methods, true);
final List pds = merge(getters, setters); final List<PropertyDescriptor> pds = merge(getters, setters);
final PropertyDescriptor[] array = new PropertyDescriptor[pds.size()]; final PropertyDescriptor[] array = new PropertyDescriptor[pds.size()];
pds.toArray(array); pds.toArray(array);
return array; return array;
@ -66,8 +66,8 @@ public class BeanIntrospector {
private static final String GETTER = "get"; private static final String GETTER = "get";
private static final String BOOLEAN_GETTER = "is"; private static final String BOOLEAN_GETTER = "is";
private static Map getPDs(final Method[] methods, final boolean setters) throws IntrospectionException { private static Map<String, PropertyDescriptor> getPDs(final Method[] methods, final boolean setters) throws IntrospectionException {
final Map pds = new HashMap(); final Map<String, PropertyDescriptor> pds = new HashMap<String, PropertyDescriptor>();
for (final Method method : methods) { for (final Method method : methods) {
String pName = null; String pName = null;
PropertyDescriptor pDescriptor = null; PropertyDescriptor pDescriptor = null;
@ -94,10 +94,10 @@ public class BeanIntrospector {
return pds; return pds;
} }
private static List merge(final Map getters, final Map setters) throws IntrospectionException { private static List<PropertyDescriptor> merge(final Map<String, PropertyDescriptor> getters, final Map<String, PropertyDescriptor> setters) throws IntrospectionException {
final List props = new ArrayList(); final List<PropertyDescriptor> props = new ArrayList<PropertyDescriptor>();
final Set processedProps = new HashSet(); final Set<String> processedProps = new HashSet<String>();
final Iterator gs = getters.keySet().iterator(); final Iterator<String> gs = getters.keySet().iterator();
while (gs.hasNext()) { while (gs.hasNext()) {
final String name = (String) gs.next(); final String name = (String) gs.next();
final PropertyDescriptor getter = (PropertyDescriptor) getters.get(name); final PropertyDescriptor getter = (PropertyDescriptor) getters.get(name);
@ -110,9 +110,9 @@ public class BeanIntrospector {
props.add(getter); props.add(getter);
} }
} }
final Set writeOnlyProps = new HashSet(setters.keySet()); final Set<String> writeOnlyProps = new HashSet<String>(setters.keySet());
writeOnlyProps.removeAll(processedProps); writeOnlyProps.removeAll(processedProps);
final Iterator ss = writeOnlyProps.iterator(); final Iterator<String> ss = writeOnlyProps.iterator();
while (ss.hasNext()) { while (ss.hasNext()) {
final String name = (String) ss.next(); final String name = (String) ss.next();
final PropertyDescriptor setter = (PropertyDescriptor) setters.get(name); final PropertyDescriptor setter = (PropertyDescriptor) setters.get(name);

View file

@ -100,27 +100,27 @@ public class CopyFromHelper {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private Object doCopy(Object value, final Class<?> baseInterface) throws Exception { private <T> T doCopy(T value, final Class<?> baseInterface) throws Exception {
if (value != null) { if (value != null) {
final Class<?> vClass = value.getClass(); final Class<?> vClass = value.getClass();
if (vClass.isArray()) { if (vClass.isArray()) {
value = doCopyArray(value, baseInterface); value = (T) this.<Object>doCopyArray((Object[]) value, baseInterface);
} else if (value instanceof Collection) { } else if (value instanceof Collection) {
value = doCopyCollection((Collection<?>) value, baseInterface); value = (T) this.<Object>doCopyCollection((Collection<Object>) value, baseInterface);
} else if (value instanceof Map) { } else if (value instanceof Map) {
value = doCopyMap((Map<Object, Object>) value, baseInterface); value = (T) this.<Object, Object>doCopyMap((Map<Object, Object>) value, baseInterface);
} else if (isBasicType(vClass)) { } else if (isBasicType(vClass)) {
// value = value; // nothing to do here // value = value; // nothing to do here
if (value instanceof Date) { // because Date it is not inmutable if (value instanceof Date) { // because Date it is not inmutable
value = ((Date) value).clone(); value = (T) ((Date) value).clone();
} }
} else { // it goes CopyFrom } else { // it goes CopyFrom
if (value instanceof CopyFrom<?>) { if (value instanceof CopyFrom<?>) {
final CopyFrom<?> source = (CopyFrom<?>) value; final CopyFrom<T> source = (CopyFrom<T>) value;
CopyFrom<?> target = createInstance(source.getInterface()); CopyFrom<T> target = (CopyFrom<T>) createInstance(source.getInterface());
target = target == null ? (CopyFrom<?>) value.getClass().newInstance() : target; target = target == null ? (CopyFrom<T>) value.getClass().newInstance() : target;
target.copyFrom(source); target.copyFrom(source);
value = target; value = (T) target;
} else { } else {
throw new Exception("unsupported class for 'copyFrom' " + value.getClass()); throw new Exception("unsupported class for 'copyFrom' " + value.getClass());
} }
@ -129,10 +129,11 @@ public class CopyFromHelper {
return value; return value;
} }
private Object doCopyArray(final Object array, final Class<?> baseInterface) throws Exception { private <T> T[] doCopyArray(final T[] array, final Class<?> baseInterface) throws Exception {
final Class<?> elementClass = array.getClass().getComponentType(); final Class<?> elementClass = array.getClass().getComponentType();
final int length = Array.getLength(array); final int length = Array.getLength(array);
final Object newArray = Array.newInstance(elementClass, length); @SuppressWarnings("unchecked")
final T[] newArray = (T[]) Array.newInstance(elementClass, length);
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
final Object element = doCopy(Array.get(array, i), baseInterface); final Object element = doCopy(Array.get(array, i), baseInterface);
Array.set(newArray, i, element); Array.set(newArray, i, element);
@ -140,21 +141,21 @@ public class CopyFromHelper {
return newArray; return newArray;
} }
private Collection<Object> doCopyCollection(final Collection<?> collection, final Class<?> baseInterface) throws Exception { private <T> Collection<T> doCopyCollection(final Collection<T> collection, final Class<?> baseInterface) throws Exception {
// expecting SETs or LISTs only, going default implementation of them // expecting SETs or LISTs only, going default implementation of them
final Collection<Object> newColl = collection instanceof Set ? new HashSet<Object>() : new ArrayList<Object>(); final Collection<T> newColl = collection instanceof Set ? new HashSet<T>() : new ArrayList<T>();
final Iterator<?> i = collection.iterator(); final Iterator<T> i = collection.iterator();
while (i.hasNext()) { while (i.hasNext()) {
newColl.add(doCopy(i.next(), baseInterface)); newColl.add(this.<T>doCopy(i.next(), baseInterface));
} }
return newColl; return newColl;
} }
private Map<Object, Object> doCopyMap(final Map<Object, Object> map, final Class<?> baseInterface) throws Exception { private <S, T> Map<S, T> doCopyMap(final Map<S, T> map, final Class<?> baseInterface) throws Exception {
final Map<Object, Object> newMap = new HashMap<Object, Object>(); final Map<S, T> newMap = new HashMap<S, T>();
final Iterator<Entry<Object, Object>> entries = map.entrySet().iterator(); final Iterator<Entry<S, T>> entries = map.entrySet().iterator();
while (entries.hasNext()) { while (entries.hasNext()) {
final Map.Entry<Object, Object> entry = entries.next(); final Map.Entry<S, T> entry = entries.next();
newMap.put(entry.getKey(), doCopy(entry.getValue(), baseInterface)); newMap.put(entry.getKey(), doCopy(entry.getValue(), baseInterface));
} }
return newMap; return newMap;

View file

@ -37,10 +37,11 @@ import java.lang.reflect.Method;
* *
*/ */
public class EqualsBean implements Serializable { public class EqualsBean implements Serializable {
private static final long serialVersionUID = 9120107899175152601L;
private static final Object[] NO_PARAMS = new Object[0]; private static final Object[] NO_PARAMS = new Object[0];
private final Class beanClass; private final Class<?> beanClass;
private final Object obj; private final Object obj;
/** /**
@ -52,7 +53,7 @@ public class EqualsBean implements Serializable {
* @param beanClass the class/interface to be used for property scanning. * @param beanClass the class/interface to be used for property scanning.
* *
*/ */
protected EqualsBean(final Class beanClass) { protected EqualsBean(final Class<?> beanClass) {
this.beanClass = beanClass; this.beanClass = beanClass;
obj = this; obj = this;
} }
@ -86,7 +87,7 @@ public class EqualsBean implements Serializable {
* @param obj object bean to test equality. * @param obj object bean to test equality.
* *
*/ */
public EqualsBean(final Class beanClass, final Object obj) { public EqualsBean(final Class<?> beanClass, final Object obj) {
if (!beanClass.isInstance(obj)) { if (!beanClass.isInstance(obj)) {
throw new IllegalArgumentException(obj.getClass() + " is not instance of " + beanClass); throw new IllegalArgumentException(obj.getClass() + " is not instance of " + beanClass);
} }
@ -214,8 +215,8 @@ public class EqualsBean implements Serializable {
private boolean doEquals(final Object obj1, final Object obj2) { private boolean doEquals(final Object obj1, final Object obj2) {
boolean eq = obj1 == obj2; boolean eq = obj1 == obj2;
if (!eq && obj1 != null && obj2 != null) { if (!eq && obj1 != null && obj2 != null) {
final Class classObj1 = obj1.getClass(); final Class<?> classObj1 = obj1.getClass();
final Class classObj2 = obj2.getClass(); final Class<?> classObj2 = obj2.getClass();
if (classObj1.isArray() && classObj2.isArray()) { if (classObj1.isArray() && classObj2.isArray()) {
eq = equalsArray(obj1, obj2); eq = equalsArray(obj1, obj2);
} else { } else {

View file

@ -23,6 +23,7 @@ import java.lang.reflect.Method;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import java.util.Stack; import java.util.Stack;
/** /**
@ -37,12 +38,14 @@ import java.util.Stack;
* *
*/ */
public class ToStringBean implements Serializable { public class ToStringBean implements Serializable {
private static final ThreadLocal PREFIX_TL = new ThreadLocal() { private static final long serialVersionUID = -5850496718959612854L;
private static final ThreadLocal<Stack<String[]>> PREFIX_TL = new ThreadLocal<Stack<String[]>>() {
@Override @Override
public Object get() { public Stack<String[]> get() {
Object o = super.get(); Stack<String[]> o = super.get();
if (o == null) { if (o == null) {
o = new Stack(); o = new Stack<String[]>();
set(o); set(o);
} }
return o; return o;
@ -51,7 +54,7 @@ public class ToStringBean implements Serializable {
private static final Object[] NO_PARAMS = new Object[0]; private static final Object[] NO_PARAMS = new Object[0];
private final Class beanClass; private final Class<?> beanClass;
private final Object obj; private final Object obj;
/** /**
@ -64,7 +67,7 @@ public class ToStringBean implements Serializable {
* interface class. * interface class.
* *
*/ */
protected ToStringBean(final Class beanClass) { protected ToStringBean(final Class<?> beanClass) {
this.beanClass = beanClass; this.beanClass = beanClass;
obj = this; obj = this;
} }
@ -95,7 +98,7 @@ public class ToStringBean implements Serializable {
* @param obj object bean to create String representation. * @param obj object bean to create String representation.
* *
*/ */
public ToStringBean(final Class beanClass, final Object obj) { public ToStringBean(final Class<?> beanClass, final Object obj) {
this.beanClass = beanClass; this.beanClass = beanClass;
this.obj = obj; this.obj = obj;
} }
@ -111,8 +114,8 @@ public class ToStringBean implements Serializable {
*/ */
@Override @Override
public String toString() { public String toString() {
final Stack stack = (Stack) PREFIX_TL.get(); final Stack<String[]> stack = PREFIX_TL.get();
final String[] tsInfo = (String[]) (stack.isEmpty() ? null : stack.peek()); final String[] tsInfo = (stack.isEmpty() ? null : stack.peek());
String prefix; String prefix;
if (tsInfo == null) { if (tsInfo == null) {
final String className = obj.getClass().getName(); final String className = obj.getClass().getName();
@ -168,18 +171,19 @@ public class ToStringBean implements Serializable {
} else if (value.getClass().isArray()) { } else if (value.getClass().isArray()) {
printArrayProperty(sb, prefix, value); printArrayProperty(sb, prefix, value);
} else if (value instanceof Map) { } else if (value instanceof Map) {
final Map map = (Map) value; @SuppressWarnings("unchecked")
final Iterator i = map.entrySet().iterator(); final Map<Object, Object> map = (Map<Object, Object>) value;
final Iterator<Entry<Object, Object>> i = map.entrySet().iterator();
if (i.hasNext()) { if (i.hasNext()) {
while (i.hasNext()) { while (i.hasNext()) {
final Map.Entry me = (Map.Entry) i.next(); final Map.Entry<Object, Object> me = i.next();
final String ePrefix = prefix + "[" + me.getKey() + "]"; final String ePrefix = prefix + "[" + me.getKey() + "]";
final Object eValue = me.getValue(); final Object eValue = me.getValue();
// NEW // NEW
final String[] tsInfo = new String[2]; final String[] tsInfo = new String[2];
tsInfo[0] = ePrefix; tsInfo[0] = ePrefix;
final Stack stack = (Stack) PREFIX_TL.get(); final Stack<String[]> stack = PREFIX_TL.get();
stack.push(tsInfo); stack.push(tsInfo);
final String s = eValue != null ? eValue.toString() : "null"; final String s = eValue != null ? eValue.toString() : "null";
stack.pop(); stack.pop();
@ -193,8 +197,9 @@ public class ToStringBean implements Serializable {
sb.append(prefix).append("=[]\n"); sb.append(prefix).append("=[]\n");
} }
} else if (value instanceof Collection) { } else if (value instanceof Collection) {
final Collection collection = (Collection) value; @SuppressWarnings("unchecked")
final Iterator i = collection.iterator(); final Collection<Object> collection = (Collection<Object>) value;
final Iterator<Object> i = collection.iterator();
if (i.hasNext()) { if (i.hasNext()) {
int c = 0; int c = 0;
while (i.hasNext()) { while (i.hasNext()) {
@ -204,7 +209,7 @@ public class ToStringBean implements Serializable {
// NEW // NEW
final String[] tsInfo = new String[2]; final String[] tsInfo = new String[2];
tsInfo[0] = cPrefix; tsInfo[0] = cPrefix;
final Stack stack = (Stack) PREFIX_TL.get(); final Stack<String[]> stack = PREFIX_TL.get();
stack.push(tsInfo); stack.push(tsInfo);
final String s = cValue != null ? cValue.toString() : "null"; final String s = cValue != null ? cValue.toString() : "null";
stack.pop(); stack.pop();
@ -220,7 +225,7 @@ public class ToStringBean implements Serializable {
} else { } else {
final String[] tsInfo = new String[2]; final String[] tsInfo = new String[2];
tsInfo[0] = prefix; tsInfo[0] = prefix;
final Stack stack = (Stack) PREFIX_TL.get(); final Stack<String[]> stack = PREFIX_TL.get();
stack.push(tsInfo); stack.push(tsInfo);
final String s = value.toString(); final String s = value.toString();
stack.pop(); stack.pop();

View file

@ -946,7 +946,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
} }
@Override @Override
public final void copyFrom(final CopyFrom<?> obj) { public final void copyFrom(final CopyFrom<Module> obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }

View file

@ -161,7 +161,7 @@ public class DCSubjectImpl implements Cloneable, Serializable, DCSubject {
} }
@Override @Override
public void copyFrom(final CopyFrom<?> obj) { public void copyFrom(final CopyFrom<DCSubject> obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }

View file

@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* *
*/ */
public abstract class ModuleImpl implements Cloneable, Serializable, Module { public abstract class ModuleImpl implements Cloneable, Serializable, Module {
private static final long serialVersionUID = 3621352305155841238L;
private final ObjectBean objBean; private final ObjectBean objBean;
private final String uri; private final String uri;
@ -39,7 +40,7 @@ public abstract class ModuleImpl implements Cloneable, Serializable, Module {
* @param uri URI of the module. * @param uri URI of the module.
* *
*/ */
protected ModuleImpl(final Class beanClass, final String uri) { protected ModuleImpl(final Class<?> beanClass, final String uri) {
objBean = new ObjectBean(beanClass, this); objBean = new ObjectBean(beanClass, this);
this.uri = uri; this.uri = uri;
} }

View file

@ -37,6 +37,7 @@ import com.sun.syndication.feed.impl.CopyFromHelper;
* *
*/ */
public class SyModuleImpl extends ModuleImpl implements SyModule { public class SyModuleImpl extends ModuleImpl implements SyModule {
private static final long serialVersionUID = -8345879299577437933L;
private static final Set<String> PERIODS = new HashSet<String>(); private static final Set<String> PERIODS = new HashSet<String>();
static { static {
@ -144,19 +145,19 @@ public class SyModuleImpl extends ModuleImpl implements SyModule {
} }
@Override @Override
public void copyFrom(final CopyFrom obj) { public void copyFrom(final CopyFrom<Module> obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }
private static final CopyFromHelper COPY_FROM_HELPER; private static final CopyFromHelper COPY_FROM_HELPER;
static { static {
final Map basePropInterfaceMap = new HashMap(); final Map<String, Class<?>> basePropInterfaceMap = new HashMap<String, Class<?>>();
basePropInterfaceMap.put("updatePeriod", String.class); basePropInterfaceMap.put("updatePeriod", String.class);
basePropInterfaceMap.put("updateFrequency", Integer.TYPE); basePropInterfaceMap.put("updateFrequency", Integer.TYPE);
basePropInterfaceMap.put("updateBase", Date.class); basePropInterfaceMap.put("updateBase", Date.class);
final Map basePropClassImplMap = Collections.EMPTY_MAP; final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom<?>>, Class<?>>emptyMap();
COPY_FROM_HELPER = new CopyFromHelper(SyModule.class, basePropInterfaceMap, basePropClassImplMap); COPY_FROM_HELPER = new CopyFromHelper(SyModule.class, basePropInterfaceMap, basePropClassImplMap);
} }

View file

@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* *
*/ */
public class Category implements Cloneable, Serializable { public class Category implements Cloneable, Serializable {
private static final long serialVersionUID = -5474322292323751503L;
private final ObjectBean objBean; private final ObjectBean objBean;
private String domain; private String domain;
private String value; private String value;

View file

@ -39,6 +39,7 @@ import com.sun.syndication.feed.module.impl.ModuleUtils;
* *
*/ */
public class Channel extends WireFeed { public class Channel extends WireFeed {
private static final long serialVersionUID = 745207486449728472L;
public static final String SUNDAY = "sunday"; public static final String SUNDAY = "sunday";
public static final String MONDAY = "monday"; public static final String MONDAY = "monday";
public static final String TUESDAY = "tuesday"; public static final String TUESDAY = "tuesday";

View file

@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* *
*/ */
public class Cloud implements Cloneable, Serializable { public class Cloud implements Cloneable, Serializable {
private static final long serialVersionUID = 7380217488816772041L;
private final ObjectBean objBean; private final ObjectBean objBean;
private String domain; private String domain;
private int port; private int port;

View file

@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* *
*/ */
public class Content implements Cloneable, Serializable { public class Content implements Cloneable, Serializable {
private static final long serialVersionUID = -9157875649722243971L;
public static final String HTML = "html"; public static final String HTML = "html";
public static final String TEXT = "text"; public static final String TEXT = "text";
private final ObjectBean objBean; private final ObjectBean objBean;

View file

@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* *
*/ */
public class Description implements Cloneable, Serializable { public class Description implements Cloneable, Serializable {
private static final long serialVersionUID = 2110945913225451453L;
private final ObjectBean objBean; private final ObjectBean objBean;
private String type; private String type;
private String value; private String value;

View file

@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* *
*/ */
public class Enclosure implements Cloneable, Serializable { public class Enclosure implements Cloneable, Serializable {
private static final long serialVersionUID = -2191354241339637856L;
private final ObjectBean objBean; private final ObjectBean objBean;
private String url; private String url;
private long length; private long length;

View file

@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* *
*/ */
public class Guid implements Cloneable, Serializable { public class Guid implements Cloneable, Serializable {
private static final long serialVersionUID = -3915169615222624604L;
private final ObjectBean objBean; private final ObjectBean objBean;
private boolean permaLink; private boolean permaLink;
private String value; private String value;

View file

@ -28,6 +28,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* *
*/ */
public class Image implements Cloneable, Serializable { public class Image implements Cloneable, Serializable {
private static final long serialVersionUID = 1051390283106745465L;
private final ObjectBean objBean; private final ObjectBean objBean;
private String title; private String title;
private String url; private String url;

View file

@ -42,6 +42,7 @@ import com.sun.syndication.feed.module.impl.ModuleUtils;
* *
*/ */
public class Item implements Cloneable, Serializable, Extendable { public class Item implements Cloneable, Serializable, Extendable {
private static final long serialVersionUID = 3741763947754555947L;
private final ObjectBean objBean; private final ObjectBean objBean;
private String title; private String title;
private String link; private String link;

View file

@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* *
*/ */
public class Source implements Cloneable, Serializable { public class Source implements Cloneable, Serializable {
private static final long serialVersionUID = 7117390459877365931L;
private final ObjectBean objBean; private final ObjectBean objBean;
private String url; private String url;
private String value; private String value;

View file

@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* *
*/ */
public class TextInput implements Cloneable, Serializable { public class TextInput implements Cloneable, Serializable {
private static final long serialVersionUID = -3262516270222989190L;
private final ObjectBean objBean; private final ObjectBean objBean;
private String title; private String title;
private String description; private String description;

View file

@ -34,6 +34,7 @@ import com.sun.syndication.feed.module.DCSubjectImpl;
* *
*/ */
public class SyndCategoryImpl implements Serializable, SyndCategory { public class SyndCategoryImpl implements Serializable, SyndCategory {
private static final long serialVersionUID = -2151815243404151131L;
private final ObjectBean objBean; private final ObjectBean objBean;
private final DCSubject subject; private final DCSubject subject;

View file

@ -33,6 +33,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
* *
*/ */
public class SyndContentImpl implements Serializable, SyndContent { public class SyndContentImpl implements Serializable, SyndContent {
private static final long serialVersionUID = -8831050456661121113L;
private final ObjectBean objBean; private final ObjectBean objBean;
private String type; private String type;
private String value; private String value;
@ -178,23 +179,23 @@ public class SyndContentImpl implements Serializable, SyndContent {
} }
@Override @Override
public Class getInterface() { public Class<SyndContent> getInterface() {
return SyndContent.class; return SyndContent.class;
} }
@Override @Override
public void copyFrom(final CopyFrom obj) { public void copyFrom(final CopyFrom<SyndContent> obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }
private static final CopyFromHelper COPY_FROM_HELPER; private static final CopyFromHelper COPY_FROM_HELPER;
static { static {
final Map basePropInterfaceMap = new HashMap(); final Map<String, Class<?>> basePropInterfaceMap = new HashMap<String, Class<?>>();
basePropInterfaceMap.put("type", String.class); basePropInterfaceMap.put("type", String.class);
basePropInterfaceMap.put("value", String.class); basePropInterfaceMap.put("value", String.class);
final Map basePropClassImplMap = Collections.EMPTY_MAP; final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom<?>>, Class<?>>emptyMap();
COPY_FROM_HELPER = new CopyFromHelper(SyndContent.class, basePropInterfaceMap, basePropClassImplMap); COPY_FROM_HELPER = new CopyFromHelper(SyndContent.class, basePropInterfaceMap, basePropClassImplMap);
} }

View file

@ -154,7 +154,7 @@ public class SyndEnclosureImpl implements Serializable, SyndEnclosure {
} }
@Override @Override
public void copyFrom(final CopyFrom<?> obj) { public void copyFrom(final CopyFrom<SyndEnclosure> obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }

View file

@ -489,7 +489,7 @@ public class SyndEntryImpl implements Serializable, SyndEntry {
} }
@Override @Override
public void copyFrom(final CopyFrom<?> obj) { public void copyFrom(final CopyFrom<SyndEntry> obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }

View file

@ -52,6 +52,7 @@ import com.sun.syndication.feed.synd.impl.URINormalizer;
* *
*/ */
public class SyndFeedImpl implements Serializable, SyndFeed { public class SyndFeedImpl implements Serializable, SyndFeed {
private static final long serialVersionUID = -2529165503200548045L;
private final ObjectBean objBean; private final ObjectBean objBean;
@ -102,7 +103,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
* @return the real feed type supported. * @return the real feed type supported.
*/ */
@Override @Override
public List getSupportedFeedTypes() { public List<String> getSupportedFeedTypes() {
return CONVERTERS.getSupportedFeedTypes(); return CONVERTERS.getSupportedFeedTypes();
} }
@ -117,7 +118,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
* CloneableBean for details). * CloneableBean for details).
* *
*/ */
protected SyndFeedImpl(final Class beanClass, final Set convenienceProperties) { protected SyndFeedImpl(final Class<?> beanClass, final Set<String> convenienceProperties) {
objBean = new ObjectBean(beanClass, this, convenienceProperties); objBean = new ObjectBean(beanClass, this, convenienceProperties);
} }
@ -779,12 +780,12 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
} }
@Override @Override
public Class getInterface() { public Class<SyndFeed> getInterface() {
return SyndFeed.class; return SyndFeed.class;
} }
@Override @Override
public void copyFrom(final CopyFrom obj) { public void copyFrom(final CopyFrom<SyndFeed> obj) {
COPY_FROM_HELPER.copy(this, obj); COPY_FROM_HELPER.copy(this, obj);
} }
@ -793,7 +794,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
private static final CopyFromHelper COPY_FROM_HELPER; private static final CopyFromHelper COPY_FROM_HELPER;
static { static {
final Map basePropInterfaceMap = new HashMap(); final Map<String, Class<?>> basePropInterfaceMap = new HashMap<String, Class<?>>();
basePropInterfaceMap.put("feedType", String.class); basePropInterfaceMap.put("feedType", String.class);
basePropInterfaceMap.put("encoding", String.class); basePropInterfaceMap.put("encoding", String.class);
basePropInterfaceMap.put("uri", String.class); basePropInterfaceMap.put("uri", String.class);
@ -804,7 +805,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
basePropInterfaceMap.put("entries", SyndEntry.class); basePropInterfaceMap.put("entries", SyndEntry.class);
basePropInterfaceMap.put("modules", Module.class); basePropInterfaceMap.put("modules", Module.class);
final Map basePropClassImplMap = new HashMap(); final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = new HashMap<Class<? extends CopyFrom<?>>, Class<?>>();
basePropClassImplMap.put(SyndEntry.class, SyndEntryImpl.class); basePropClassImplMap.put(SyndEntry.class, SyndEntryImpl.class);
basePropClassImplMap.put(SyndImage.class, SyndImageImpl.class); basePropClassImplMap.put(SyndImage.class, SyndImageImpl.class);
basePropClassImplMap.put(DCModule.class, DCModuleImpl.class); basePropClassImplMap.put(DCModule.class, DCModuleImpl.class);

View file

@ -205,7 +205,7 @@ public class SyndImageImpl implements Serializable, SyndImage {
} }
@Override @Override
public void copyFrom(final CopyFrom<?> syndImage) { public void copyFrom(final CopyFrom<SyndImage> syndImage) {
COPY_FROM_HELPER.copy(this, syndImage); COPY_FROM_HELPER.copy(this, syndImage);
} }

View file

@ -25,7 +25,7 @@ import com.sun.syndication.io.impl.PluginManager;
* Created by IntelliJ IDEA. User: tucu Date: May 21, 2004 Time: 5:26:04 PM To * Created by IntelliJ IDEA. User: tucu Date: May 21, 2004 Time: 5:26:04 PM To
* change this template use Options | File Templates. * change this template use Options | File Templates.
*/ */
public class Converters extends PluginManager { public class Converters extends PluginManager<Converter> {
/** /**
* Converter.classes= [className] ... * Converter.classes= [className] ...
@ -38,15 +38,15 @@ public class Converters extends PluginManager {
} }
public Converter getConverter(final String feedType) { public Converter getConverter(final String feedType) {
return (Converter) getPlugin(feedType); return getPlugin(feedType);
} }
@Override @Override
protected String getKey(final Object obj) { protected String getKey(final Converter obj) {
return ((Converter) obj).getType(); return obj.getType();
} }
public List getSupportedFeedTypes() { public List<String> getSupportedFeedTypes() {
return getKeys(); return getKeys();
} }

View file

@ -53,8 +53,8 @@ public class FeedGenerators extends PluginManager<WireFeedGenerator> {
} }
@Override @Override
protected String getKey(final Object obj) { protected String getKey(final WireFeedGenerator obj) {
return ((WireFeedGenerator) obj).getType(); return obj.getType();
} }
public List<String> getSupportedFeedTypes() { public List<String> getSupportedFeedTypes() {

View file

@ -83,8 +83,8 @@ public class FeedParsers extends PluginManager<WireFeedParser> {
} }
@Override @Override
protected String getKey(final Object obj) { protected String getKey(final WireFeedParser obj) {
return ((WireFeedParser) obj).getType(); return obj.getType();
} }
} }

View file

@ -41,8 +41,8 @@ public class ModuleGenerators extends PluginManager<ModuleGenerator> {
} }
@Override @Override
protected String getKey(final Object obj) { protected String getKey(final ModuleGenerator obj) {
return ((ModuleGenerator) obj).getNamespaceUri(); return obj.getNamespaceUri();
} }
public List<String> getModuleNamespaces() { public List<String> getModuleNamespaces() {

View file

@ -34,8 +34,8 @@ public class ModuleParsers extends PluginManager<ModuleParser> {
} }
@Override @Override
public String getKey(final Object obj) { public String getKey(final ModuleParser obj) {
return ((ModuleParser) obj).getNamespaceUri(); return obj.getNamespaceUri();
} }
public List<String> getModuleNamespaces() { public List<String> getModuleNamespaces() {

View file

@ -63,7 +63,7 @@ public abstract class PluginManager<T> {
keys = Collections.unmodifiableList(new ArrayList<String>(pluginsMap.keySet())); keys = Collections.unmodifiableList(new ArrayList<String>(pluginsMap.keySet()));
} }
protected abstract String getKey(Object obj); protected abstract String getKey(T obj);
protected List<String> getKeys() { protected List<String> getKeys() {
return keys; return keys;