You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2012/03/15 23:08:23 UTC
svn commit: r1301237 -
/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/
Author: mbenson
Date: Thu Mar 15 22:08:23 2012
New Revision: 1301237
URL: http://svn.apache.org/viewvc?rev=1301237&view=rev
Log:
java 5isms incl. @Override and generics-related warnings
Modified:
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/BaseEntityCollectionReflector.java
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/ByteArrayToEntityCopier.java
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/ContainerToIndexedEntityCollectionCopier.java
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityCollectionReflector.java
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityInstantiatingReflector.java
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityToByteArrayConverter.java
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/FieldOptionConstantConverter.java
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/IndexedEntityCollectionInstantiatingReflector.java
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/IndexedEntityCollectionReflector.java
commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/TextToEntityCopier.java
Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/BaseEntityCollectionReflector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/BaseEntityCollectionReflector.java?rev=1301237&r1=1301236&r2=1301237&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/BaseEntityCollectionReflector.java (original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/BaseEntityCollectionReflector.java Thu Mar 15 22:08:23 2012
@@ -234,14 +234,15 @@ public abstract class BaseEntityCollecti
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- protected Class<?> getContainedTypeImpl(Class c) throws Exception {
+ @Override
+ protected Class<?> getContainedTypeImpl(@SuppressWarnings("rawtypes") Class c) throws Exception {
return Entity.class;
}
/**
* {@inheritDoc}
*/
+ @Override
protected Iterator<Entity> getIteratorImpl(Object o) throws Exception {
return ((EntityCollection) o).getChildren().iterator();
}
@@ -249,6 +250,7 @@ public abstract class BaseEntityCollecti
/**
* {@inheritDoc}
*/
+ @Override
protected int getSizeImpl(Object o) throws Exception {
return ((EntityCollection) o).getChildren().size();
}
@@ -256,6 +258,7 @@ public abstract class BaseEntityCollecti
/**
* {@inheritDoc}
*/
+ @Override
protected Class<?> getTypeImpl(Object bean, String propertyName) throws Exception {
return getPropertyAccessor(propertyName).getTypeFrom(bean);
}
@@ -263,6 +266,7 @@ public abstract class BaseEntityCollecti
/**
* {@inheritDoc}
*/
+ @Override
protected Object getImpl(Object container, int index) throws Exception {
Entity e = getEntity(container, index);
return e instanceof EntityCollection ? (Object) e : getString(e);
@@ -271,6 +275,7 @@ public abstract class BaseEntityCollecti
/**
* {@inheritDoc}
*/
+ @Override
protected Object getImpl(Object bean, String propertyName) throws Exception {
return getPropertyAccessor(propertyName).getFrom(bean);
}
@@ -278,6 +283,7 @@ public abstract class BaseEntityCollecti
/**
* {@inheritDoc}
*/
+ @Override
protected void setImpl(Object bean, String propertyName, Object value) throws Exception {
getPropertyAccessor(propertyName).setOn(bean, value);
}
@@ -285,6 +291,7 @@ public abstract class BaseEntityCollecti
/**
* {@inheritDoc}
*/
+ @Override
protected Object setImpl(Object container, int index, Object propertyValue) throws Exception {
Entity e = getEntity(container, index);
byte[] result = e.getValue();
@@ -305,6 +312,7 @@ public abstract class BaseEntityCollecti
/**
* {@inheritDoc}
*/
+ @Override
protected String[] getPropertyNamesImpl(Object bean) throws Exception {
HashSet<String> result = new HashSet<String>();
if (this instanceof IndexedContainerReflector) {
@@ -356,6 +364,7 @@ public abstract class BaseEntityCollecti
/**
* {@inheritDoc}
*/
+ @Override
protected boolean isReadableImpl(Object bean, String propertyName) throws Exception {
return getPropertyAccessor(propertyName).isReadableOn(bean);
}
@@ -363,6 +372,7 @@ public abstract class BaseEntityCollecti
/**
* {@inheritDoc}
*/
+ @Override
protected boolean isWriteableImpl(Object bean, String propertyName) throws Exception {
return getPropertyAccessor(propertyName).isWriteableOn(bean);
}
Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/ByteArrayToEntityCopier.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/ByteArrayToEntityCopier.java?rev=1301237&r1=1301236&r2=1301237&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/ByteArrayToEntityCopier.java (original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/ByteArrayToEntityCopier.java Thu Mar 15 22:08:23 2012
@@ -35,6 +35,7 @@ public class ByteArrayToEntityCopier ext
/**
* {@inheritDoc}
*/
+ @Override
protected void copyImpl(Object destination, Object source, Locale locale,
Integer preferredTransformationType) throws Exception {
((Entity) destination).setValue((byte[]) source);
@@ -43,6 +44,7 @@ public class ByteArrayToEntityCopier ext
/**
* {@inheritDoc}
*/
+ @Override
protected Class<?>[] getSourceClassesImpl() throws Exception {
return new Class[] { byte[].class };
}
@@ -50,6 +52,7 @@ public class ByteArrayToEntityCopier ext
/**
* {@inheritDoc}
*/
+ @Override
protected Class<?>[] getDestinationClassesImpl() throws Exception {
return new Class[] { Entity.class };
}
Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/ContainerToIndexedEntityCollectionCopier.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/ContainerToIndexedEntityCollectionCopier.java?rev=1301237&r1=1301236&r2=1301237&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/ContainerToIndexedEntityCollectionCopier.java (original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/ContainerToIndexedEntityCollectionCopier.java Thu Mar 15 22:08:23 2012
@@ -46,6 +46,7 @@ public class ContainerToIndexedEntityCol
/**
* {@inheritDoc}
*/
+ @Override
protected int getSizeImpl(Object container) throws Exception {
return 1;
}
@@ -64,14 +65,15 @@ public class ContainerToIndexedEntityCol
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public synchronized void setSourceClasses(Class[] sourceClasses) {
+ @Override
+ public synchronized void setSourceClasses(@SuppressWarnings("rawtypes") Class[] sourceClasses) {
super.setSourceClasses(sourceClasses);
}
/**
* {@inheritDoc}
*/
+ @Override
protected Class<?>[] getSourceClassesImpl() throws Exception {
Class<?>[] c = getBeanReflector().getReflectableClasses();
Class<?>[] result = new Class[c.length + 1];
@@ -82,14 +84,15 @@ public class ContainerToIndexedEntityCol
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public synchronized void setDestinationClasses(Class[] destinationClasses) {
+ @Override
+ public synchronized void setDestinationClasses(@SuppressWarnings("rawtypes") Class[] destinationClasses) {
super.setDestinationClasses(destinationClasses);
}
/**
* {@inheritDoc}
*/
+ @Override
protected Class<?>[] getDestinationClassesImpl() throws Exception {
return DEST_CLASSES;
}
@@ -97,6 +100,7 @@ public class ContainerToIndexedEntityCol
/**
* {@inheritDoc}
*/
+ @Override
protected void copyImpl(Object destination, Object source, Locale locale,
Integer preferredTransformationType) throws TransformationException {
int size = source == null ? 0 : getBeanReflector().getSize(source);
@@ -109,6 +113,7 @@ public class ContainerToIndexedEntityCol
/**
* {@inheritDoc}
*/
+ @Override
protected boolean isAutomaticallyHandlingNulls() {
return false;
}
Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityCollectionReflector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityCollectionReflector.java?rev=1301237&r1=1301236&r2=1301237&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityCollectionReflector.java (original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityCollectionReflector.java Thu Mar 15 22:08:23 2012
@@ -29,12 +29,13 @@ public class EntityCollectionReflector e
* Create a new EntityCollectionReflector.
*/
public EntityCollectionReflector() {
- // default
+ super();
}
/**
* {@inheritDoc}
*/
+ @Override
protected synchronized Reflector[] createDefaultComponents() {
return new Reflector[] { new IndexedEntityCollectionReflector(),
new NamedEntityCollectionReflector() };
Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityInstantiatingReflector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityInstantiatingReflector.java?rev=1301237&r1=1301236&r2=1301237&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityInstantiatingReflector.java (original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityInstantiatingReflector.java Thu Mar 15 22:08:23 2012
@@ -45,7 +45,7 @@ public class EntityInstantiatingReflecto
* Create a new EntityInstantiatingReflector.
*/
public EntityInstantiatingReflector() {
- // default constructor
+ super();
}
/**
@@ -59,6 +59,7 @@ public class EntityInstantiatingReflecto
/**
* {@inheritDoc}
*/
+ @Override
protected Class<?>[] getReflectableClassesImpl() throws Exception {
return new Class[] { Entity.class };
}
@@ -82,8 +83,8 @@ public class EntityInstantiatingReflecto
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- protected Object newInstanceImpl(Class destType, Object source)
+ @Override
+ protected Object newInstanceImpl(@SuppressWarnings("rawtypes") Class destType, Object source)
throws Exception {
Entity e = getEntityFactory().getEntity(source);
if (e instanceof IndexedEntityCollection) {
Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityToByteArrayConverter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityToByteArrayConverter.java?rev=1301237&r1=1301236&r2=1301237&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityToByteArrayConverter.java (original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/EntityToByteArrayConverter.java Thu Mar 15 22:08:23 2012
@@ -32,6 +32,7 @@ public class EntityToByteArrayConverter
/**
* {@inheritDoc}
*/
+ @Override
protected Class<?>[] getDestinationClassesImpl() throws Exception {
return new Class[] { byte[].class };
}
@@ -39,6 +40,7 @@ public class EntityToByteArrayConverter
/**
* {@inheritDoc}
*/
+ @Override
protected Class<?>[] getSourceClassesImpl() throws Exception {
return new Class[] { Entity.class };
}
@@ -46,8 +48,8 @@ public class EntityToByteArrayConverter
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- protected Object convertImpl(Class destType, Object source, Locale locale)
+ @Override
+ protected Object convertImpl(@SuppressWarnings("rawtypes") Class destType, Object source, Locale locale)
throws Exception {
return ((Entity) source).getValue();
}
Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/FieldOptionConstantConverter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/FieldOptionConstantConverter.java?rev=1301237&r1=1301236&r2=1301237&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/FieldOptionConstantConverter.java (original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/FieldOptionConstantConverter.java Thu Mar 15 22:08:23 2012
@@ -36,6 +36,8 @@ public class FieldOptionConstantConverte
/**
* {@inheritDoc}
*/
+ @SuppressWarnings("rawtypes")
+ @Override
protected Class[] getDestinationClassesImpl() throws Exception {
return new Class[] { FieldOption.class };
}
@@ -43,6 +45,8 @@ public class FieldOptionConstantConverte
/**
* {@inheritDoc}
*/
+ @SuppressWarnings("rawtypes")
+ @Override
protected Class[] getSourceClassesImpl() throws Exception {
return getTextConverter().getSourceClasses();
}
@@ -50,7 +54,8 @@ public class FieldOptionConstantConverte
/**
* {@inheritDoc}
*/
- protected Object convertImpl(Class destinationClass, Object source,
+ @Override
+ protected Object convertImpl(@SuppressWarnings("rawtypes") Class destinationClass, Object source,
Locale locale) throws Exception {
String constant = (String) getTextConverter().convert(String.class,
source, locale);
Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/IndexedEntityCollectionInstantiatingReflector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/IndexedEntityCollectionInstantiatingReflector.java?rev=1301237&r1=1301236&r2=1301237&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/IndexedEntityCollectionInstantiatingReflector.java (original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/IndexedEntityCollectionInstantiatingReflector.java Thu Mar 15 22:08:23 2012
@@ -44,6 +44,7 @@ public class IndexedEntityCollectionInst
/**
* {@inheritDoc}
*/
+ @Override
protected Class<?>[] getReflectableClassesImpl() throws Exception {
return new Class[] { IndexedEntityCollection.class };
}
@@ -68,14 +69,14 @@ public class IndexedEntityCollectionInst
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- protected Object newInstanceImpl(Class destType, Object source)
+ @Override
+ protected Object newInstanceImpl(@SuppressWarnings("rawtypes") Class destType, Object source)
throws Exception {
int size = CONTAINER_REFLECTOR.getSize(source);
if (size == 0) {
return new EntityArray(0);
}
- Class containedType = source == null ? null : CONTAINER_REFLECTOR
+ Class<?> containedType = source == null ? null : CONTAINER_REFLECTOR
.getContainedType(source.getClass());
Entity prototype = (Entity) getComponentReflector().newInstance(
destType, containedType);
Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/IndexedEntityCollectionReflector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/IndexedEntityCollectionReflector.java?rev=1301237&r1=1301236&r2=1301237&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/IndexedEntityCollectionReflector.java (original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/IndexedEntityCollectionReflector.java Thu Mar 15 22:08:23 2012
@@ -39,6 +39,7 @@ public class IndexedEntityCollectionRefl
/**
* {@inheritDoc}
*/
+ @Override
protected Entity getEntity(Object container, int index) throws Exception {
return ((IndexedEntityCollection) container).getChild(index);
}
@@ -46,6 +47,7 @@ public class IndexedEntityCollectionRefl
/**
* {@inheritDoc}
*/
+ @Override
protected Class<?>[] getReflectableClassesImpl() throws Exception {
return new Class[] { IndexedEntityCollection.class };
}
@@ -53,6 +55,7 @@ public class IndexedEntityCollectionRefl
/**
* {@inheritDoc}
*/
+ @Override
protected boolean isEntity(Object bean, String propertyName)
throws Exception {
if (bean instanceof EntityArray
@@ -69,14 +72,15 @@ public class IndexedEntityCollectionRefl
/**
* {@inheritDoc}
*/
+ @Override
protected Object getImpl(Object bean, String propertyName) throws Exception {
return super.getImpl(bean, propertyName);
}
/**
* {@inheritDoc}
- * @see com.pgac.flatfile.morph.BaseEntityCollectionReflector#getEntity(java.lang.Object, java.lang.String)
*/
+ @Override
protected Entity getEntity(Object bean, String propertyName)
throws Exception {
if (bean instanceof EntityArray
@@ -88,8 +92,8 @@ public class IndexedEntityCollectionRefl
/**
* {@inheritDoc}
- * @see com.pgac.flatfile.morph.BaseEntityCollectionReflector#getSizeImpl(java.lang.Object)
*/
+ @Override
protected int getSizeImpl(Object o) throws Exception {
int size = ((IndexedEntityCollection) o).size();
return size < 0 ? 0 : size;
Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/TextToEntityCopier.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/TextToEntityCopier.java?rev=1301237&r1=1301236&r2=1301237&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/TextToEntityCopier.java (original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/morph/TextToEntityCopier.java Thu Mar 15 22:08:23 2012
@@ -36,32 +36,34 @@ public class TextToEntityCopier extends
/**
* {@inheritDoc}
*/
+ @Override
protected void copyImpl(Object destination, Object source, Locale locale,
Integer preferredTransformationType) throws Exception {
- byte[] b = (byte[]) getTextConverter().convert(byte[].class, source,
- locale);
+ byte[] b =
+ (byte[]) getTextConverter().convert(byte[].class, source, locale);
((Entity) destination).setValue(b);
}
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public synchronized void setSourceClasses(Class[] sourceClasses) {
+ @Override
+ public synchronized void setSourceClasses(@SuppressWarnings("rawtypes") Class[] sourceClasses) {
super.setSourceClasses(sourceClasses);
}
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public synchronized void setDestinationClasses(Class[] destinationClasses) {
+ @Override
+ public synchronized void setDestinationClasses(@SuppressWarnings("rawtypes") Class[] destinationClasses) {
super.setDestinationClasses(destinationClasses);
}
/**
* {@inheritDoc}
*/
+ @Override
protected Class<?>[] getDestinationClassesImpl() throws Exception {
return new Class[] { Entity.class };
}
@@ -69,6 +71,7 @@ public class TextToEntityCopier extends
/**
* {@inheritDoc}
*/
+ @Override
protected Class<?>[] getSourceClassesImpl() throws Exception {
return getTextConverter().getSourceClasses();
}