Removed type parameter from CopyFrom interface
This commit is contained in:
parent
1f2001abc5
commit
d4b34a05cd
19 changed files with 40 additions and 40 deletions
|
@ -20,7 +20,7 @@ package com.sun.syndication.feed;
|
|||
/**
|
||||
* @author Alejandro Abdelnur
|
||||
*/
|
||||
public interface CopyFrom<T> {
|
||||
public interface CopyFrom {
|
||||
|
||||
/**
|
||||
* Returns the interface the copyFrom works on.
|
||||
|
@ -31,7 +31,7 @@ public interface CopyFrom<T> {
|
|||
*
|
||||
* @return the interface the copyFrom works on.
|
||||
*/
|
||||
public Class<? extends CopyFrom<T>> getInterface();
|
||||
public Class<? extends CopyFrom> getInterface();
|
||||
|
||||
/**
|
||||
* Copies all the properties of the given bean into this one.
|
||||
|
@ -45,6 +45,6 @@ public interface CopyFrom<T> {
|
|||
* @param obj the instance to copy properties from.
|
||||
*
|
||||
*/
|
||||
public void copyFrom(CopyFrom<? extends T> obj);
|
||||
public void copyFrom(CopyFrom obj);
|
||||
|
||||
}
|
||||
|
|
|
@ -46,9 +46,9 @@ public class CopyFromHelper {
|
|||
private static final Set<Class<?>> BASIC_TYPES = new HashSet<Class<?>>();
|
||||
private static final Object[] NO_PARAMS = new Object[0];
|
||||
|
||||
private final Class<? extends CopyFrom<?>> beanInterfaceClass;
|
||||
private final Class<? extends CopyFrom> beanInterfaceClass;
|
||||
private final Map<String, Class<?>> baseInterfaceMap; // ENTRIES(propertyName,interface.class)
|
||||
private final Map<Class<? extends CopyFrom<?>>, Class<?>> baseImplMap; // ENTRIES(interface.class,implementation.class)
|
||||
private final Map<Class<? extends CopyFrom>, Class<?>> baseImplMap; // ENTRIES(interface.class,implementation.class)
|
||||
|
||||
static {
|
||||
BASIC_TYPES.add(Boolean.class);
|
||||
|
@ -63,8 +63,8 @@ public class CopyFromHelper {
|
|||
BASIC_TYPES.add(Date.class);
|
||||
}
|
||||
|
||||
public CopyFromHelper(final Class<? extends CopyFrom<?>> beanInterfaceClass, final Map<String, Class<?>> basePropInterfaceMap,
|
||||
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap) {
|
||||
public CopyFromHelper(final Class<? extends CopyFrom> beanInterfaceClass, final Map<String, Class<?>> basePropInterfaceMap,
|
||||
final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap) {
|
||||
this.beanInterfaceClass = beanInterfaceClass;
|
||||
baseInterfaceMap = basePropInterfaceMap;
|
||||
baseImplMap = basePropClassImplMap;
|
||||
|
@ -104,11 +104,11 @@ public class CopyFromHelper {
|
|||
|
||||
}
|
||||
|
||||
private CopyFrom<?> createInstance(final Class<? extends CopyFrom<?>> interfaceClass) throws Exception {
|
||||
private CopyFrom createInstance(final Class<? extends CopyFrom> interfaceClass) throws Exception {
|
||||
if (baseImplMap.get(interfaceClass) == null) {
|
||||
return null;
|
||||
} else {
|
||||
return (CopyFrom<?>) baseImplMap.get(interfaceClass).newInstance();
|
||||
return (CopyFrom) baseImplMap.get(interfaceClass).newInstance();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,11 +128,11 @@ public class CopyFromHelper {
|
|||
value = (T) ((Date) value).clone();
|
||||
}
|
||||
} else { // it goes CopyFrom
|
||||
if (value instanceof CopyFrom<?>) {
|
||||
final CopyFrom<T> source = (CopyFrom<T>) value;
|
||||
CopyFrom<T> target = (CopyFrom<T>) createInstance(source.getInterface());
|
||||
if (value instanceof CopyFrom) {
|
||||
final CopyFrom source = (CopyFrom) value;
|
||||
CopyFrom target = (CopyFrom) createInstance(source.getInterface());
|
||||
if (target == null) {
|
||||
target = (CopyFrom<T>) value.getClass().newInstance();
|
||||
target = (CopyFrom) value.getClass().newInstance();
|
||||
}
|
||||
target.copyFrom(source);
|
||||
value = (T) target;
|
||||
|
|
|
@ -1031,7 +1031,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final void copyFrom(final CopyFrom<? extends Module> obj) {
|
||||
public final void copyFrom(final CopyFrom obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
|
@ -1055,7 +1055,7 @@ public class DCModuleImpl extends ModuleImpl implements DCModule {
|
|||
basePropInterfaceMap.put("coverages", String.class);
|
||||
basePropInterfaceMap.put("rightsList", String.class);
|
||||
|
||||
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = new HashMap<Class<? extends CopyFrom<?>>, Class<?>>();
|
||||
final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = new HashMap<Class<? extends CopyFrom>, Class<?>>();
|
||||
basePropClassImplMap.put(DCSubject.class, DCSubjectImpl.class);
|
||||
|
||||
COPY_FROM_HELPER = new CopyFromHelper(DCModule.class, basePropInterfaceMap, basePropClassImplMap);
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.sun.syndication.feed.CopyFrom;
|
|||
* @author Alejandro Abdelnur
|
||||
*
|
||||
*/
|
||||
public interface DCSubject extends Cloneable, CopyFrom<DCSubject> {
|
||||
public interface DCSubject extends Cloneable, CopyFrom {
|
||||
/**
|
||||
* Returns the DublinCore subject taxonomy URI.
|
||||
* <p>
|
||||
|
|
|
@ -158,7 +158,7 @@ public class DCSubjectImpl implements Cloneable, Serializable, DCSubject {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom<? extends DCSubject> obj) {
|
||||
public void copyFrom(final CopyFrom obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ public class DCSubjectImpl implements Cloneable, Serializable, DCSubject {
|
|||
basePropInterfaceMap.put("taxonomyUri", String.class);
|
||||
basePropInterfaceMap.put("value", String.class);
|
||||
|
||||
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom<?>>, Class<?>> emptyMap();
|
||||
final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom>, Class<?>> emptyMap();
|
||||
|
||||
COPY_FROM_HELPER = new CopyFromHelper(DCSubject.class, basePropInterfaceMap, basePropClassImplMap);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import com.sun.syndication.feed.CopyFrom;
|
|||
* @author Alejandro Abdelnur
|
||||
*
|
||||
*/
|
||||
public interface Module extends Cloneable, CopyFrom<Module>, Serializable {
|
||||
public interface Module extends Cloneable, CopyFrom, Serializable {
|
||||
|
||||
/**
|
||||
* Returns the URI of the module.
|
||||
|
|
|
@ -140,7 +140,7 @@ public class SyModuleImpl extends ModuleImpl implements SyModule {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom<? extends Module> obj) {
|
||||
public void copyFrom(final CopyFrom obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ public class SyModuleImpl extends ModuleImpl implements SyModule {
|
|||
basePropInterfaceMap.put("updateFrequency", Integer.TYPE);
|
||||
basePropInterfaceMap.put("updateBase", Date.class);
|
||||
|
||||
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom<?>>, Class<?>> emptyMap();
|
||||
final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom>, Class<?>> emptyMap();
|
||||
|
||||
COPY_FROM_HELPER = new CopyFromHelper(SyModule.class, basePropInterfaceMap, basePropClassImplMap);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.sun.syndication.feed.CopyFrom;
|
|||
* @author Alejandro Abdelnur
|
||||
*
|
||||
*/
|
||||
public interface SyndCategory extends Cloneable, CopyFrom<SyndCategory> {
|
||||
public interface SyndCategory extends Cloneable, CopyFrom {
|
||||
/**
|
||||
* Returns the category name.
|
||||
* <p>
|
||||
|
|
|
@ -180,12 +180,12 @@ public class SyndCategoryImpl implements Serializable, SyndCategory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends CopyFrom<SyndCategory>> getInterface() {
|
||||
public Class<? extends CopyFrom> getInterface() {
|
||||
return SyndCategory.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom<? extends SyndCategory> obj) {
|
||||
public void copyFrom(final CopyFrom obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ public class SyndCategoryImpl implements Serializable, SyndCategory {
|
|||
final Map<String, Class<?>> basePropInterfaceMap = new HashMap<String, Class<?>>();
|
||||
basePropInterfaceMap.put("name", String.class);
|
||||
basePropInterfaceMap.put("taxonomyUri", String.class);
|
||||
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = Collections.emptyMap();
|
||||
final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = Collections.emptyMap();
|
||||
COPY_FROM_HELPER = new CopyFromHelper(SyndCategory.class, basePropInterfaceMap, basePropClassImplMap);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.sun.syndication.feed.CopyFrom;
|
|||
* @author Alejandro Abdelnur
|
||||
*
|
||||
*/
|
||||
public interface SyndContent extends Cloneable, CopyFrom<SyndContent> {
|
||||
public interface SyndContent extends Cloneable, CopyFrom {
|
||||
/**
|
||||
* Returns the content type.
|
||||
* <p>
|
||||
|
|
|
@ -181,7 +181,7 @@ public class SyndContentImpl implements Serializable, SyndContent {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom<? extends SyndContent> obj) {
|
||||
public void copyFrom(final CopyFrom obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ public class SyndContentImpl implements Serializable, SyndContent {
|
|||
basePropInterfaceMap.put("type", String.class);
|
||||
basePropInterfaceMap.put("value", String.class);
|
||||
|
||||
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom<?>>, Class<?>> emptyMap();
|
||||
final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom>, Class<?>> emptyMap();
|
||||
|
||||
COPY_FROM_HELPER = new CopyFromHelper(SyndContent.class, basePropInterfaceMap, basePropClassImplMap);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.sun.syndication.feed.CopyFrom;
|
|||
/**
|
||||
* @author Alejandro Abdelnur
|
||||
*/
|
||||
public interface SyndEnclosure extends Cloneable, CopyFrom<SyndEnclosure> {
|
||||
public interface SyndEnclosure extends Cloneable, CopyFrom {
|
||||
/**
|
||||
* Returns the enclosure URL.
|
||||
* <p>
|
||||
|
|
|
@ -153,7 +153,7 @@ public class SyndEnclosureImpl implements Serializable, SyndEnclosure {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom<? extends SyndEnclosure> obj) {
|
||||
public void copyFrom(final CopyFrom obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ public class SyndEnclosureImpl implements Serializable, SyndEnclosure {
|
|||
basePropInterfaceMap.put("type", String.class);
|
||||
basePropInterfaceMap.put("length", Long.TYPE);
|
||||
|
||||
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom<?>>, Class<?>> emptyMap();
|
||||
final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom>, Class<?>> emptyMap();
|
||||
|
||||
COPY_FROM_HELPER = new CopyFromHelper(SyndEnclosure.class, basePropInterfaceMap, basePropClassImplMap);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import com.sun.syndication.feed.module.Module;
|
|||
* @author Alejandro Abdelnur
|
||||
*
|
||||
*/
|
||||
public interface SyndEntry extends Cloneable, CopyFrom<SyndEntry>, Extendable {
|
||||
public interface SyndEntry extends Cloneable, CopyFrom, Extendable {
|
||||
|
||||
/**
|
||||
* Returns the entry URI.
|
||||
|
|
|
@ -483,7 +483,7 @@ public class SyndEntryImpl implements Serializable, SyndEntry {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom<? extends SyndEntry> obj) {
|
||||
public void copyFrom(final CopyFrom obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ public class SyndEntryImpl implements Serializable, SyndEntry {
|
|||
basePropInterfaceMap.put("modules", Module.class);
|
||||
basePropInterfaceMap.put("categories", SyndCategory.class);
|
||||
|
||||
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = new HashMap<Class<? extends CopyFrom<?>>, Class<?>>();
|
||||
final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = new HashMap<Class<? extends CopyFrom>, Class<?>>();
|
||||
basePropClassImplMap.put(SyndContent.class, SyndContentImpl.class);
|
||||
basePropClassImplMap.put(SyndEnclosure.class, SyndEnclosureImpl.class);
|
||||
basePropClassImplMap.put(SyndCategory.class, SyndCategoryImpl.class);
|
||||
|
|
|
@ -35,7 +35,7 @@ import com.sun.syndication.feed.module.Module;
|
|||
* @author Alejandro Abdelnur
|
||||
*
|
||||
*/
|
||||
public interface SyndFeed extends Cloneable, CopyFrom<SyndFeed>, Extendable {
|
||||
public interface SyndFeed extends Cloneable, CopyFrom, Extendable {
|
||||
|
||||
/**
|
||||
* Returns the real feed types the SyndFeedImpl supports when converting from and to.
|
||||
|
|
|
@ -762,7 +762,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom<? extends SyndFeed> obj) {
|
||||
public void copyFrom(final CopyFrom obj) {
|
||||
COPY_FROM_HELPER.copy(this, obj);
|
||||
}
|
||||
|
||||
|
@ -783,7 +783,7 @@ public class SyndFeedImpl implements Serializable, SyndFeed {
|
|||
basePropInterfaceMap.put("modules", Module.class);
|
||||
basePropInterfaceMap.put("categories", SyndCategory.class);
|
||||
|
||||
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = new HashMap<Class<? extends CopyFrom<?>>, Class<?>>();
|
||||
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(SyndCategory.class, SyndCategoryImpl.class);
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.sun.syndication.feed.CopyFrom;
|
|||
* @author Alejandro Abdelnur
|
||||
*
|
||||
*/
|
||||
public interface SyndImage extends Cloneable, CopyFrom<SyndImage> {
|
||||
public interface SyndImage extends Cloneable, CopyFrom {
|
||||
/**
|
||||
* Returns the image title.
|
||||
* <p>
|
||||
|
|
|
@ -204,7 +204,7 @@ public class SyndImageImpl implements Serializable, SyndImage {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void copyFrom(final CopyFrom<? extends SyndImage> syndImage) {
|
||||
public void copyFrom(final CopyFrom syndImage) {
|
||||
COPY_FROM_HELPER.copy(this, syndImage);
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ public class SyndImageImpl implements Serializable, SyndImage {
|
|||
basePropInterfaceMap.put("link", String.class);
|
||||
basePropInterfaceMap.put("description", String.class);
|
||||
|
||||
final Map<Class<? extends CopyFrom<?>>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom<?>>, Class<?>> emptyMap();
|
||||
final Map<Class<? extends CopyFrom>, Class<?>> basePropClassImplMap = Collections.<Class<? extends CopyFrom>, Class<?>> emptyMap();
|
||||
|
||||
COPY_FROM_HELPER = new CopyFromHelper(SyndImage.class, basePropInterfaceMap, basePropClassImplMap);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue