more generics and missing serialVersionUIDs added
This commit is contained in:
parent
0fb698ee99
commit
77c50c516b
37 changed files with 119 additions and 91 deletions
|
@ -31,7 +31,7 @@ public interface CopyFrom<T> {
|
|||
*
|
||||
* @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.
|
||||
|
@ -46,6 +46,6 @@ public interface CopyFrom<T> {
|
|||
* @param obj the instance to copy properties from.
|
||||
*
|
||||
*/
|
||||
public void copyFrom(CopyFrom<?> obj);
|
||||
public void copyFrom(CopyFrom<T> obj);
|
||||
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ import com.sun.syndication.feed.module.impl.ModuleUtils;
|
|||
*
|
||||
*/
|
||||
public abstract class WireFeed implements Cloneable, Serializable, Extendable {
|
||||
private static final long serialVersionUID = -3608120400805691829L;
|
||||
private final ObjectBean objBean;
|
||||
private String feedType;
|
||||
private String encoding;
|
||||
|
|
|
@ -27,6 +27,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
* @author Dave Johnson (added for Atom 1.0)
|
||||
*/
|
||||
public class Category implements Cloneable, Serializable {
|
||||
private static final long serialVersionUID = -2034251366664065410L;
|
||||
|
||||
private final ObjectBean objBean;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
* @author Dave Johnson (updated for Atom 1.0)
|
||||
*/
|
||||
public class Content implements Cloneable, Serializable {
|
||||
private static final long serialVersionUID = 2036205883043031310L;
|
||||
|
||||
private final ObjectBean objBean;
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
*
|
||||
*/
|
||||
public class Generator implements Cloneable, Serializable {
|
||||
private static final long serialVersionUID = -1457065669831041059L;
|
||||
private final ObjectBean objBean;
|
||||
private String url;
|
||||
private String version;
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
* @author Dave Johnson (updated for Atom 1.0)
|
||||
*/
|
||||
public class Link implements Cloneable, Serializable {
|
||||
private static final long serialVersionUID = 670365139518027828L;
|
||||
|
||||
private final ObjectBean objBean;
|
||||
|
||||
|
|
|
@ -41,10 +41,10 @@ import java.util.Set;
|
|||
*/
|
||||
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 {
|
||||
PropertyDescriptor[] descriptors = (PropertyDescriptor[]) introspected.get(klass);
|
||||
public static synchronized PropertyDescriptor[] getPropertyDescriptors(final Class<?> klass) throws IntrospectionException {
|
||||
PropertyDescriptor[] descriptors = introspected.get(klass);
|
||||
if (descriptors == null) {
|
||||
descriptors = getPDs(klass);
|
||||
introspected.put(klass, descriptors);
|
||||
|
@ -52,11 +52,11 @@ public class BeanIntrospector {
|
|||
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 Map getters = getPDs(methods, false);
|
||||
final Map setters = getPDs(methods, true);
|
||||
final List pds = merge(getters, setters);
|
||||
final Map<String, PropertyDescriptor> getters = getPDs(methods, false);
|
||||
final Map<String, PropertyDescriptor> setters = getPDs(methods, true);
|
||||
final List<PropertyDescriptor> pds = merge(getters, setters);
|
||||
final PropertyDescriptor[] array = new PropertyDescriptor[pds.size()];
|
||||
pds.toArray(array);
|
||||
return array;
|
||||
|
@ -66,8 +66,8 @@ public class BeanIntrospector {
|
|||
private static final String GETTER = "get";
|
||||
private static final String BOOLEAN_GETTER = "is";
|
||||
|
||||
private static Map getPDs(final Method[] methods, final boolean setters) throws IntrospectionException {
|
||||
final Map pds = new HashMap();
|
||||
private static Map<String, PropertyDescriptor> getPDs(final Method[] methods, final boolean setters) throws IntrospectionException {
|
||||
final Map<String, PropertyDescriptor> pds = new HashMap<String, PropertyDescriptor>();
|
||||
for (final Method method : methods) {
|
||||
String pName = null;
|
||||
PropertyDescriptor pDescriptor = null;
|
||||
|
@ -94,10 +94,10 @@ public class BeanIntrospector {
|
|||
return pds;
|
||||
}
|
||||
|
||||
private static List merge(final Map getters, final Map setters) throws IntrospectionException {
|
||||
final List props = new ArrayList();
|
||||
final Set processedProps = new HashSet();
|
||||
final Iterator gs = getters.keySet().iterator();
|
||||
private static List<PropertyDescriptor> merge(final Map<String, PropertyDescriptor> getters, final Map<String, PropertyDescriptor> setters) throws IntrospectionException {
|
||||
final List<PropertyDescriptor> props = new ArrayList<PropertyDescriptor>();
|
||||
final Set<String> processedProps = new HashSet<String>();
|
||||
final Iterator<String> gs = getters.keySet().iterator();
|
||||
while (gs.hasNext()) {
|
||||
final String name = (String) gs.next();
|
||||
final PropertyDescriptor getter = (PropertyDescriptor) getters.get(name);
|
||||
|
@ -110,9 +110,9 @@ public class BeanIntrospector {
|
|||
props.add(getter);
|
||||
}
|
||||
}
|
||||
final Set writeOnlyProps = new HashSet(setters.keySet());
|
||||
final Set<String> writeOnlyProps = new HashSet<String>(setters.keySet());
|
||||
writeOnlyProps.removeAll(processedProps);
|
||||
final Iterator ss = writeOnlyProps.iterator();
|
||||
final Iterator<String> ss = writeOnlyProps.iterator();
|
||||
while (ss.hasNext()) {
|
||||
final String name = (String) ss.next();
|
||||
final PropertyDescriptor setter = (PropertyDescriptor) setters.get(name);
|
||||
|
|
|
@ -100,27 +100,27 @@ public class CopyFromHelper {
|
|||
}
|
||||
|
||||
@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) {
|
||||
final Class<?> vClass = value.getClass();
|
||||
if (vClass.isArray()) {
|
||||
value = doCopyArray(value, baseInterface);
|
||||
value = (T) this.<Object>doCopyArray((Object[]) value, baseInterface);
|
||||
} else if (value instanceof Collection) {
|
||||
value = doCopyCollection((Collection<?>) value, baseInterface);
|
||||
value = (T) this.<Object>doCopyCollection((Collection<Object>) value, baseInterface);
|
||||
} 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)) {
|
||||
// value = value; // nothing to do here
|
||||
if (value instanceof Date) { // because Date it is not inmutable
|
||||
value = ((Date) value).clone();
|
||||
value = (T) ((Date) value).clone();
|
||||
}
|
||||
} else { // it goes CopyFrom
|
||||
if (value instanceof CopyFrom<?>) {
|
||||
final CopyFrom<?> source = (CopyFrom<?>) value;
|
||||
CopyFrom<?> target = createInstance(source.getInterface());
|
||||
target = target == null ? (CopyFrom<?>) value.getClass().newInstance() : target;
|
||||
final CopyFrom<T> source = (CopyFrom<T>) value;
|
||||
CopyFrom<T> target = (CopyFrom<T>) createInstance(source.getInterface());
|
||||
target = target == null ? (CopyFrom<T>) value.getClass().newInstance() : target;
|
||||
target.copyFrom(source);
|
||||
value = target;
|
||||
value = (T) target;
|
||||
} else {
|
||||
throw new Exception("unsupported class for 'copyFrom' " + value.getClass());
|
||||
}
|
||||
|
@ -129,10 +129,11 @@ public class CopyFromHelper {
|
|||
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 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++) {
|
||||
final Object element = doCopy(Array.get(array, i), baseInterface);
|
||||
Array.set(newArray, i, element);
|
||||
|
@ -140,21 +141,21 @@ public class CopyFromHelper {
|
|||
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
|
||||
final Collection<Object> newColl = collection instanceof Set ? new HashSet<Object>() : new ArrayList<Object>();
|
||||
final Iterator<?> i = collection.iterator();
|
||||
final Collection<T> newColl = collection instanceof Set ? new HashSet<T>() : new ArrayList<T>();
|
||||
final Iterator<T> i = collection.iterator();
|
||||
while (i.hasNext()) {
|
||||
newColl.add(doCopy(i.next(), baseInterface));
|
||||
newColl.add(this.<T>doCopy(i.next(), baseInterface));
|
||||
}
|
||||
return newColl;
|
||||
}
|
||||
|
||||
private Map<Object, Object> doCopyMap(final Map<Object, Object> map, final Class<?> baseInterface) throws Exception {
|
||||
final Map<Object, Object> newMap = new HashMap<Object, Object>();
|
||||
final Iterator<Entry<Object, Object>> entries = map.entrySet().iterator();
|
||||
private <S, T> Map<S, T> doCopyMap(final Map<S, T> map, final Class<?> baseInterface) throws Exception {
|
||||
final Map<S, T> newMap = new HashMap<S, T>();
|
||||
final Iterator<Entry<S, T>> entries = map.entrySet().iterator();
|
||||
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));
|
||||
}
|
||||
return newMap;
|
||||
|
|
|
@ -37,10 +37,11 @@ import java.lang.reflect.Method;
|
|||
*
|
||||
*/
|
||||
public class EqualsBean implements Serializable {
|
||||
private static final long serialVersionUID = 9120107899175152601L;
|
||||
|
||||
private static final Object[] NO_PARAMS = new Object[0];
|
||||
|
||||
private final Class beanClass;
|
||||
private final Class<?> beanClass;
|
||||
private final Object obj;
|
||||
|
||||
/**
|
||||
|
@ -52,7 +53,7 @@ public class EqualsBean implements Serializable {
|
|||
* @param beanClass the class/interface to be used for property scanning.
|
||||
*
|
||||
*/
|
||||
protected EqualsBean(final Class beanClass) {
|
||||
protected EqualsBean(final Class<?> beanClass) {
|
||||
this.beanClass = beanClass;
|
||||
obj = this;
|
||||
}
|
||||
|
@ -86,7 +87,7 @@ public class EqualsBean implements Serializable {
|
|||
* @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)) {
|
||||
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) {
|
||||
boolean eq = obj1 == obj2;
|
||||
if (!eq && obj1 != null && obj2 != null) {
|
||||
final Class classObj1 = obj1.getClass();
|
||||
final Class classObj2 = obj2.getClass();
|
||||
final Class<?> classObj1 = obj1.getClass();
|
||||
final Class<?> classObj2 = obj2.getClass();
|
||||
if (classObj1.isArray() && classObj2.isArray()) {
|
||||
eq = equalsArray(obj1, obj2);
|
||||
} else {
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.lang.reflect.Method;
|
|||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Stack;
|
||||
|
||||
/**
|
||||
|
@ -37,12 +38,14 @@ import java.util.Stack;
|
|||
*
|
||||
*/
|
||||
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
|
||||
public Object get() {
|
||||
Object o = super.get();
|
||||
public Stack<String[]> get() {
|
||||
Stack<String[]> o = super.get();
|
||||
if (o == null) {
|
||||
o = new Stack();
|
||||
o = new Stack<String[]>();
|
||||
set(o);
|
||||
}
|
||||
return o;
|
||||
|
@ -51,7 +54,7 @@ public class ToStringBean implements Serializable {
|
|||
|
||||
private static final Object[] NO_PARAMS = new Object[0];
|
||||
|
||||
private final Class beanClass;
|
||||
private final Class<?> beanClass;
|
||||
private final Object obj;
|
||||
|
||||
/**
|
||||
|
@ -64,7 +67,7 @@ public class ToStringBean implements Serializable {
|
|||
* interface class.
|
||||
*
|
||||
*/
|
||||
protected ToStringBean(final Class beanClass) {
|
||||
protected ToStringBean(final Class<?> beanClass) {
|
||||
this.beanClass = beanClass;
|
||||
obj = this;
|
||||
}
|
||||
|
@ -95,7 +98,7 @@ public class ToStringBean implements Serializable {
|
|||
* @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.obj = obj;
|
||||
}
|
||||
|
@ -111,8 +114,8 @@ public class ToStringBean implements Serializable {
|
|||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
final Stack stack = (Stack) PREFIX_TL.get();
|
||||
final String[] tsInfo = (String[]) (stack.isEmpty() ? null : stack.peek());
|
||||
final Stack<String[]> stack = PREFIX_TL.get();
|
||||
final String[] tsInfo = (stack.isEmpty() ? null : stack.peek());
|
||||
String prefix;
|
||||
if (tsInfo == null) {
|
||||
final String className = obj.getClass().getName();
|
||||
|
@ -168,18 +171,19 @@ public class ToStringBean implements Serializable {
|
|||
} else if (value.getClass().isArray()) {
|
||||
printArrayProperty(sb, prefix, value);
|
||||
} else if (value instanceof Map) {
|
||||
final Map map = (Map) value;
|
||||
final Iterator i = map.entrySet().iterator();
|
||||
@SuppressWarnings("unchecked")
|
||||
final Map<Object, Object> map = (Map<Object, Object>) value;
|
||||
final Iterator<Entry<Object, Object>> i = map.entrySet().iterator();
|
||||
if (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 Object eValue = me.getValue();
|
||||
|
||||
// NEW
|
||||
final String[] tsInfo = new String[2];
|
||||
tsInfo[0] = ePrefix;
|
||||
final Stack stack = (Stack) PREFIX_TL.get();
|
||||
final Stack<String[]> stack = PREFIX_TL.get();
|
||||
stack.push(tsInfo);
|
||||
final String s = eValue != null ? eValue.toString() : "null";
|
||||
stack.pop();
|
||||
|
@ -193,8 +197,9 @@ public class ToStringBean implements Serializable {
|
|||
sb.append(prefix).append("=[]\n");
|
||||
}
|
||||
} else if (value instanceof Collection) {
|
||||
final Collection collection = (Collection) value;
|
||||
final Iterator i = collection.iterator();
|
||||
@SuppressWarnings("unchecked")
|
||||
final Collection<Object> collection = (Collection<Object>) value;
|
||||
final Iterator<Object> i = collection.iterator();
|
||||
if (i.hasNext()) {
|
||||
int c = 0;
|
||||
while (i.hasNext()) {
|
||||
|
@ -204,7 +209,7 @@ public class ToStringBean implements Serializable {
|
|||
// NEW
|
||||
final String[] tsInfo = new String[2];
|
||||
tsInfo[0] = cPrefix;
|
||||
final Stack stack = (Stack) PREFIX_TL.get();
|
||||
final Stack<String[]> stack = PREFIX_TL.get();
|
||||
stack.push(tsInfo);
|
||||
final String s = cValue != null ? cValue.toString() : "null";
|
||||
stack.pop();
|
||||
|
@ -220,7 +225,7 @@ public class ToStringBean implements Serializable {
|
|||
} else {
|
||||
final String[] tsInfo = new String[2];
|
||||
tsInfo[0] = prefix;
|
||||
final Stack stack = (Stack) PREFIX_TL.get();
|
||||
final Stack<String[]> stack = PREFIX_TL.get();
|
||||
stack.push(tsInfo);
|
||||
final String s = value.toString();
|
||||
stack.pop();
|
||||
|
|
|
@ -946,7 +946,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final void copyFrom(final CopyFrom<?> obj) {
|
||||
public final void copyFrom(final CopyFrom<Module> obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ public class DCSubjectImpl implements Cloneable, Serializable, DCSubject {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom<?> obj) {
|
||||
public void copyFrom(final CopyFrom<DCSubject> obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
*
|
||||
*/
|
||||
public abstract class ModuleImpl implements Cloneable, Serializable, Module {
|
||||
private static final long serialVersionUID = 3621352305155841238L;
|
||||
private final ObjectBean objBean;
|
||||
private final String uri;
|
||||
|
||||
|
@ -39,7 +40,7 @@ public abstract class ModuleImpl implements Cloneable, Serializable, 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);
|
||||
this.uri = uri;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.sun.syndication.feed.impl.CopyFromHelper;
|
|||
*
|
||||
*/
|
||||
public class SyModuleImpl extends ModuleImpl implements SyModule {
|
||||
private static final long serialVersionUID = -8345879299577437933L;
|
||||
private static final Set<String> PERIODS = new HashSet<String>();
|
||||
|
||||
static {
|
||||
|
@ -144,19 +145,19 @@ public class SyModuleImpl extends ModuleImpl implements SyModule {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom obj) {
|
||||
public void copyFrom(final CopyFrom<Module> obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
private static final CopyFromHelper COPY_FROM_HELPER;
|
||||
|
||||
static {
|
||||
final Map basePropInterfaceMap = new HashMap();
|
||||
final Map<String, Class<?>> basePropInterfaceMap = new HashMap<String, Class<?>>();
|
||||
basePropInterfaceMap.put("updatePeriod", String.class);
|
||||
basePropInterfaceMap.put("updateFrequency", Integer.TYPE);
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
*
|
||||
*/
|
||||
public class Category implements Cloneable, Serializable {
|
||||
private static final long serialVersionUID = -5474322292323751503L;
|
||||
private final ObjectBean objBean;
|
||||
private String domain;
|
||||
private String value;
|
||||
|
|
|
@ -39,6 +39,7 @@ import com.sun.syndication.feed.module.impl.ModuleUtils;
|
|||
*
|
||||
*/
|
||||
public class Channel extends WireFeed {
|
||||
private static final long serialVersionUID = 745207486449728472L;
|
||||
public static final String SUNDAY = "sunday";
|
||||
public static final String MONDAY = "monday";
|
||||
public static final String TUESDAY = "tuesday";
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
*
|
||||
*/
|
||||
public class Cloud implements Cloneable, Serializable {
|
||||
private static final long serialVersionUID = 7380217488816772041L;
|
||||
private final ObjectBean objBean;
|
||||
private String domain;
|
||||
private int port;
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
*
|
||||
*/
|
||||
public class Content implements Cloneable, Serializable {
|
||||
private static final long serialVersionUID = -9157875649722243971L;
|
||||
public static final String HTML = "html";
|
||||
public static final String TEXT = "text";
|
||||
private final ObjectBean objBean;
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
*
|
||||
*/
|
||||
public class Description implements Cloneable, Serializable {
|
||||
private static final long serialVersionUID = 2110945913225451453L;
|
||||
private final ObjectBean objBean;
|
||||
private String type;
|
||||
private String value;
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
*
|
||||
*/
|
||||
public class Enclosure implements Cloneable, Serializable {
|
||||
private static final long serialVersionUID = -2191354241339637856L;
|
||||
private final ObjectBean objBean;
|
||||
private String url;
|
||||
private long length;
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
*
|
||||
*/
|
||||
public class Guid implements Cloneable, Serializable {
|
||||
private static final long serialVersionUID = -3915169615222624604L;
|
||||
private final ObjectBean objBean;
|
||||
private boolean permaLink;
|
||||
private String value;
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
*
|
||||
*/
|
||||
public class Image implements Cloneable, Serializable {
|
||||
private static final long serialVersionUID = 1051390283106745465L;
|
||||
private final ObjectBean objBean;
|
||||
private String title;
|
||||
private String url;
|
||||
|
|
|
@ -42,6 +42,7 @@ import com.sun.syndication.feed.module.impl.ModuleUtils;
|
|||
*
|
||||
*/
|
||||
public class Item implements Cloneable, Serializable, Extendable {
|
||||
private static final long serialVersionUID = 3741763947754555947L;
|
||||
private final ObjectBean objBean;
|
||||
private String title;
|
||||
private String link;
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
*
|
||||
*/
|
||||
public class Source implements Cloneable, Serializable {
|
||||
private static final long serialVersionUID = 7117390459877365931L;
|
||||
private final ObjectBean objBean;
|
||||
private String url;
|
||||
private String value;
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
*
|
||||
*/
|
||||
public class TextInput implements Cloneable, Serializable {
|
||||
private static final long serialVersionUID = -3262516270222989190L;
|
||||
private final ObjectBean objBean;
|
||||
private String title;
|
||||
private String description;
|
||||
|
|
|
@ -34,6 +34,7 @@ import com.sun.syndication.feed.module.DCSubjectImpl;
|
|||
*
|
||||
*/
|
||||
public class SyndCategoryImpl implements Serializable, SyndCategory {
|
||||
private static final long serialVersionUID = -2151815243404151131L;
|
||||
private final ObjectBean objBean;
|
||||
private final DCSubject subject;
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
*
|
||||
*/
|
||||
public class SyndContentImpl implements Serializable, SyndContent {
|
||||
private static final long serialVersionUID = -8831050456661121113L;
|
||||
private final ObjectBean objBean;
|
||||
private String type;
|
||||
private String value;
|
||||
|
@ -178,23 +179,23 @@ public class SyndContentImpl implements Serializable, SyndContent {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class getInterface() {
|
||||
public Class<SyndContent> getInterface() {
|
||||
return SyndContent.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom obj) {
|
||||
public void copyFrom(final CopyFrom<SyndContent> obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
private static final CopyFromHelper COPY_FROM_HELPER;
|
||||
|
||||
static {
|
||||
final Map basePropInterfaceMap = new HashMap();
|
||||
final Map<String, Class<?>> basePropInterfaceMap = new HashMap<String, Class<?>>();
|
||||
basePropInterfaceMap.put("type", 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);
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ public class SyndEnclosureImpl implements Serializable, SyndEnclosure {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom<?> obj) {
|
||||
public void copyFrom(final CopyFrom<SyndEnclosure> obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -489,7 +489,7 @@ public class SyndEntryImpl implements Serializable, SyndEntry {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom<?> obj) {
|
||||
public void copyFrom(final CopyFrom<SyndEntry> obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ import com.sun.syndication.feed.synd.impl.URINormalizer;
|
|||
*
|
||||
*/
|
||||
public class SyndFeedImpl implements Serializable, SyndFeed {
|
||||
private static final long serialVersionUID = -2529165503200548045L;
|
||||
|
||||
private final ObjectBean objBean;
|
||||
|
||||
|
@ -102,7 +103,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
|||
* @return the real feed type supported.
|
||||
*/
|
||||
@Override
|
||||
public List getSupportedFeedTypes() {
|
||||
public List<String> getSupportedFeedTypes() {
|
||||
return CONVERTERS.getSupportedFeedTypes();
|
||||
}
|
||||
|
||||
|
@ -117,7 +118,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
|||
* 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);
|
||||
}
|
||||
|
||||
|
@ -779,12 +780,12 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class getInterface() {
|
||||
public Class<SyndFeed> getInterface() {
|
||||
return SyndFeed.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom obj) {
|
||||
public void copyFrom(final CopyFrom<SyndFeed> obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
|
@ -793,7 +794,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
|||
private static final CopyFromHelper COPY_FROM_HELPER;
|
||||
|
||||
static {
|
||||
final Map basePropInterfaceMap = new HashMap();
|
||||
final Map<String, Class<?>> basePropInterfaceMap = new HashMap<String, Class<?>>();
|
||||
basePropInterfaceMap.put("feedType", String.class);
|
||||
basePropInterfaceMap.put("encoding", String.class);
|
||||
basePropInterfaceMap.put("uri", String.class);
|
||||
|
@ -804,7 +805,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
|||
basePropInterfaceMap.put("entries", SyndEntry.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(SyndImage.class, SyndImageImpl.class);
|
||||
basePropClassImplMap.put(DCModule.class, DCModuleImpl.class);
|
||||
|
|
|
@ -205,7 +205,7 @@ public class SyndImageImpl implements Serializable, SyndImage {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom<?> syndImage) {
|
||||
public void copyFrom(final CopyFrom<SyndImage> syndImage) {
|
||||
COPY_FROM_HELPER.copy(this, syndImage);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* change this template use Options | File Templates.
|
||||
*/
|
||||
public class Converters extends PluginManager {
|
||||
public class Converters extends PluginManager<Converter> {
|
||||
|
||||
/**
|
||||
* Converter.classes= [className] ...
|
||||
|
@ -38,15 +38,15 @@ public class Converters extends PluginManager {
|
|||
}
|
||||
|
||||
public Converter getConverter(final String feedType) {
|
||||
return (Converter) getPlugin(feedType);
|
||||
return getPlugin(feedType);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getKey(final Object obj) {
|
||||
return ((Converter) obj).getType();
|
||||
protected String getKey(final Converter obj) {
|
||||
return obj.getType();
|
||||
}
|
||||
|
||||
public List getSupportedFeedTypes() {
|
||||
public List<String> getSupportedFeedTypes() {
|
||||
return getKeys();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,8 @@ public class FeedGenerators extends PluginManager<WireFeedGenerator> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getKey(final Object obj) {
|
||||
return ((WireFeedGenerator) obj).getType();
|
||||
protected String getKey(final WireFeedGenerator obj) {
|
||||
return obj.getType();
|
||||
}
|
||||
|
||||
public List<String> getSupportedFeedTypes() {
|
||||
|
|
|
@ -83,8 +83,8 @@ public class FeedParsers extends PluginManager<WireFeedParser> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getKey(final Object obj) {
|
||||
return ((WireFeedParser) obj).getType();
|
||||
protected String getKey(final WireFeedParser obj) {
|
||||
return obj.getType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ public class ModuleGenerators extends PluginManager<ModuleGenerator> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String getKey(final Object obj) {
|
||||
return ((ModuleGenerator) obj).getNamespaceUri();
|
||||
protected String getKey(final ModuleGenerator obj) {
|
||||
return obj.getNamespaceUri();
|
||||
}
|
||||
|
||||
public List<String> getModuleNamespaces() {
|
||||
|
|
|
@ -34,8 +34,8 @@ public class ModuleParsers extends PluginManager<ModuleParser> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getKey(final Object obj) {
|
||||
return ((ModuleParser) obj).getNamespaceUri();
|
||||
public String getKey(final ModuleParser obj) {
|
||||
return obj.getNamespaceUri();
|
||||
}
|
||||
|
||||
public List<String> getModuleNamespaces() {
|
||||
|
|
|
@ -63,7 +63,7 @@ public abstract class PluginManager<T> {
|
|||
keys = Collections.unmodifiableList(new ArrayList<String>(pluginsMap.keySet()));
|
||||
}
|
||||
|
||||
protected abstract String getKey(Object obj);
|
||||
protected abstract String getKey(T obj);
|
||||
|
||||
protected List<String> getKeys() {
|
||||
return keys;
|
||||
|
|
Loading…
Reference in a new issue