You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2007/10/18 05:38:12 UTC

svn commit: r585832 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: GenericEntity.java GenericPK.java GenericValue.java

Author: doogie
Date: Wed Oct 17 20:38:11 2007
New Revision: 585832

URL: http://svn.apache.org/viewvc?rev=585832&view=rev
Log:
Java 1.5 markup for GenericEntity.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericPK.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java?rev=585832&r1=585831&r2=585832&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java Wed Oct 17 20:38:11 2007
@@ -65,7 +65,8 @@
  * <code>Observer</code>.
  *
  */
-public class GenericEntity extends Observable implements Map, LocalizedMap, Serializable, Comparable<GenericEntity>, Cloneable, Reusable {
+public class GenericEntity extends Observable implements Map<String, Object>, LocalizedMap, Serializable, Comparable<GenericEntity>, Cloneable, Reusable {
+
     public static final String module = GenericEntity.class.getName();
     public static final GenericEntity NULL_ENTITY = new NullGenericEntity();
     public static final NullField NULL_FIELD = new NullField();
@@ -83,7 +84,7 @@
      *  between desiring to set a value to null and desiring to not modify the
      *  current value on an update.
      */
-    protected Map fields = FastMap.newInstance();
+    protected Map<String, Object> fields = FastMap.newInstance();
 
     /** Contains the entityName of this entity, necessary for efficiency when creating EJBs */
     protected String entityName = null;
@@ -117,7 +118,7 @@
     }
 
     /** Creates new GenericEntity from existing Map */
-    public static GenericEntity createGenericEntity(ModelEntity modelEntity, Map fields) {
+    public static GenericEntity createGenericEntity(ModelEntity modelEntity, Map<String, ? extends Object> fields) {
         if (modelEntity == null) {
             throw new IllegalArgumentException("Cannot create a GenericEntity with a null modelEntity parameter");
         }
@@ -153,7 +154,7 @@
     }
 
     /** Creates new GenericEntity from existing Map */
-    protected void init(ModelEntity modelEntity, Map fields) {
+    protected void init(ModelEntity modelEntity, Map<String, ? extends Object> fields) {
         if (modelEntity == null) {
             throw new IllegalArgumentException("Cannont create a GenericEntity with a null modelEntity parameter");
         }
@@ -314,7 +315,7 @@
         return isPrimaryKey(false);
     }
     public boolean isPrimaryKey(boolean requireValue) {
-        TreeSet fieldKeys = new TreeSet(this.fields.keySet());
+        TreeSet<String> fieldKeys = new TreeSet<String>(this.fields.keySet());
         Iterator pkIter = getModelEntity().getPksIterator();
         while (pkIter.hasNext()) {
             ModelField curPk = (ModelField) pkIter.next();
@@ -751,7 +752,7 @@
     }
 
     public GenericPK getPrimaryKey() {
-        Collection pkNames = FastList.newInstance();
+        Collection<String> pkNames = FastList.newInstance();
         Iterator iter = this.getModelEntity().getPksIterator();
         while (iter != null && iter.hasNext()) {
             ModelField curField = (ModelField) iter.next();
@@ -763,22 +764,22 @@
     }
 
     /** go through the pks and for each one see if there is an entry in fields to set */
-    public void setPKFields(Map fields) {
+    public void setPKFields(Map<? extends Object, ? extends Object> fields) {
         setAllFields(fields, true, null, Boolean.TRUE);
     }
 
     /** go through the pks and for each one see if there is an entry in fields to set */
-    public void setPKFields(Map fields, boolean setIfEmpty) {
+    public void setPKFields(Map<? extends Object, ? extends Object> fields, boolean setIfEmpty) {
         setAllFields(fields, setIfEmpty, null, Boolean.TRUE);
     }
 
     /** go through the non-pks and for each one see if there is an entry in fields to set */
-    public void setNonPKFields(Map fields) {
+    public void setNonPKFields(Map<? extends Object, ? extends Object> fields) {
         setAllFields(fields, true, null, Boolean.FALSE);
     }
 
     /** go through the non-pks and for each one see if there is an entry in fields to set */
-    public void setNonPKFields(Map fields, boolean setIfEmpty) {
+    public void setNonPKFields(Map<? extends Object, ? extends Object> fields, boolean setIfEmpty) {
         setAllFields(fields, setIfEmpty, null, Boolean.FALSE);
     }
     
@@ -789,7 +790,7 @@
      * @param namePrefix If not null or empty will be pre-pended to each field name (upper-casing the first letter of the field name first), and that will be used as the fields Map lookup name instead of the field-name
      * @param pks If null, get all values, if TRUE just get PKs, if FALSE just get non-PKs
      */
-    public void setAllFields(Map fields, boolean setIfEmpty, String namePrefix, Boolean pks) {
+    public void setAllFields(Map<? extends Object, ? extends Object> fields, boolean setIfEmpty, String namePrefix, Boolean pks) {
         if (fields == null) {
             return;
         }
@@ -833,7 +834,7 @@
                             String fieldStr = (String) field;
 
                             if (fieldStr.length() > 0) {
-                                this.set(curField.getName(), field);
+                                this.set(curField.getName(), fieldStr);
                             }
                         } else {
                             this.set(curField.getName(), field);
@@ -847,15 +848,15 @@
     /** Returns keys of entity fields
      * @return java.util.Collection
      */
-    public Collection getAllKeys() {
+    public Collection<String> getAllKeys() {
         return fields.keySet();
     }
 
     /** Returns key/value pairs of entity fields
      * @return java.util.Map
      */
-    public Map getAllFields() {
-        Map newMap = FastMap.newInstance();
+    public Map<String, Object> getAllFields() {
+        Map<String, Object> newMap = FastMap.newInstance();
         newMap.putAll(this.fields);
         return newMap;
     }
@@ -864,14 +865,11 @@
      * @param keysofFields the name of the fields the client is interested in
      * @return java.util.Map
      */
-    public Map getFields(Collection keysofFields) {
+    public Map<String, Object> getFields(Collection<String> keysofFields) {
         if (keysofFields == null) return null;
-        Iterator keys = keysofFields.iterator();
-        Object aKey = null;
-        Map aMap = FastMap.newInstance();
+        Map<String, Object> aMap = FastMap.newInstance();
 
-        while (keys.hasNext()) {
-            aKey = keys.next();
+        for (String aKey: keysofFields) {
             aMap.put(aKey, this.fields.get(aKey));
         }
         return aMap;
@@ -880,26 +878,18 @@
     /** Used by clients to update particular fields in the entity
      * @param keyValuePairs java.util.Map
      */
-    public synchronized void setFields(Map keyValuePairs) {
+    public synchronized void setFields(Map<? extends String, ? extends Object> keyValuePairs) {
         if (keyValuePairs == null) return;
-        Iterator entries = keyValuePairs.entrySet().iterator();
-        Map.Entry anEntry = null;
-
         // this could be implement with Map.putAll, but we'll leave it like this for the extra features it has
-        while (entries.hasNext()) {
-            anEntry = (Map.Entry) entries.next();
-            this.set((String) anEntry.getKey(), anEntry.getValue(), true);
+        for (Map.Entry<? extends String, ? extends Object> anEntry: keyValuePairs.entrySet()) {
+            this.set(anEntry.getKey(), anEntry.getValue(), true);
         }
     }
 
-    public boolean matchesFields(Map keyValuePairs) {
+    public boolean matchesFields(Map<String, ? extends Object> keyValuePairs) {
         if (fields == null) return true;
         if (keyValuePairs == null || keyValuePairs.size() == 0) return true;
-        Iterator entries = keyValuePairs.entrySet().iterator();
-
-        while (entries.hasNext()) {
-            Map.Entry anEntry = (Map.Entry) entries.next();
-
+        for (Map.Entry<String, ? extends Object> anEntry: keyValuePairs.entrySet()) {
             if (!UtilValidate.areEqual(anEntry.getValue(), this.fields.get(anEntry.getKey()))) {
                 return false;
             }
@@ -924,19 +914,17 @@
         return document;
     }
 
-    public static int addToXmlDocument(Collection values, Document document) {
+    public static int addToXmlDocument(Collection<GenericValue> values, Document document) {
         return addToXmlElement(values, document, document.getDocumentElement());
     }
 
-    public static int addToXmlElement(Collection values, Document document, Element element) {
+    public static int addToXmlElement(Collection<GenericValue> values, Document document, Element element) {
         if (values == null) return 0;
         if (document == null) return 0;
 
-        Iterator iter = values.iterator();
         int numberAdded = 0;
 
-        while (iter.hasNext()) {
-            GenericValue value = (GenericValue) iter.next();
+        for (GenericValue value: values) {
             Element valueElement = value.makeXmlElement(document);
 
             element.appendChild(valueElement);
@@ -999,7 +987,7 @@
         writer.print(this.getEntityName());
 
         // write attributes immediately and if a CDATA element is needed, put those in a Map for now
-        Map cdataMap = FastMap.newInstance();
+        Map<String, String> cdataMap = FastMap.newInstance();
 
         Iterator modelFields = this.getModelEntity().getFieldsIterator();
         while (modelFields.hasNext()) {
@@ -1120,18 +1108,14 @@
         } else {
             writer.println('>');
 
-            Iterator cdataIter = cdataMap.entrySet().iterator();
-
-            while (cdataIter.hasNext()) {
-                Map.Entry entry = (Map.Entry) cdataIter.next();
-
+            for (Map.Entry<String, String> entry: cdataMap.entrySet()) {
                 for (int i = 0; i < (indent << 1); i++) writer.print(' ');
                 writer.print('<');
-                writer.print((String) entry.getKey());
+                writer.print(entry.getKey());
                 writer.print("><![CDATA[");
-                writer.print((String) entry.getValue());
+                writer.print(entry.getValue());
                 writer.print("]]></");
-                writer.print((String) entry.getKey());
+                writer.print(entry.getKey());
                 writer.println('>');
             }
 
@@ -1186,9 +1170,7 @@
         theString.append(getEntityName());
         theString.append(']');
 
-        Iterator keyNames = new TreeSet(fields.keySet()).iterator();
-        while (keyNames.hasNext()) {
-            String curKey = (String) keyNames.next();
+        for (String curKey: new TreeSet<String>(fields.keySet())) {
             Object curValue = fields.get(curKey);
             ModelField field = this.getModelEntity().getField(curKey);
             if (field.getEncrypt()) {
@@ -1219,9 +1201,7 @@
         theString.append(getEntityName());
         theString.append(']');
 
-        Iterator keyNames = new TreeSet(fields.keySet()).iterator();
-        while (keyNames.hasNext()) {
-            String curKey = (String) keyNames.next();
+        for (String curKey: new TreeSet<String>(fields.keySet())) {
             Object curValue = fields.get(curKey);
             theString.append('[');
             theString.append(curKey);
@@ -1310,15 +1290,15 @@
         return this.fields.containsKey(key);
     }
 
-    public java.util.Set entrySet() {
-        return Collections.unmodifiableSet(this.fields.entrySet());
+    public java.util.Set<Map.Entry<String, Object>> entrySet() {
+        return Collections.unmodifiableMap(this.fields).entrySet();
     }
 
-    public Object put(Object key, Object value) {
-        return this.set((String) key, value, true);
+    public Object put(String key, Object value) {
+        return this.set(key, value, true);
     }
 
-    public void putAll(java.util.Map map) {
+    public void putAll(java.util.Map<? extends String, ? extends Object> map) {
         this.setFields(map);
     }
 
@@ -1339,7 +1319,7 @@
         }
     }
 
-    public java.util.Set keySet() {
+    public java.util.Set<String> keySet() {
         return Collections.unmodifiableSet(this.fields.keySet());
     }
 
@@ -1347,8 +1327,8 @@
         return this.fields.isEmpty();
     }
 
-    public java.util.Collection values() {
-        return Collections.unmodifiableCollection(this.fields.values());
+    public java.util.Collection<Object> values() {
+        return Collections.unmodifiableMap(this.fields).values();
     }
 
     public boolean containsValue(Object value) {

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericPK.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericPK.java?rev=585832&r1=585831&r2=585832&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericPK.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericPK.java Wed Oct 17 20:38:11 2007
@@ -30,8 +30,8 @@
  */
 public class GenericPK extends GenericEntity {
 
-    protected static final ObjectFactory genericPKFactory = new ObjectFactory() {
-        protected Object create() {
+    protected static final ObjectFactory<GenericPK> genericPKFactory = new ObjectFactory<GenericPK>() {
+        protected GenericPK create() {
             return new GenericPK();
         }
     };
@@ -40,28 +40,28 @@
     
     /** Creates new GenericPK */
     public static GenericPK create(ModelEntity modelEntity) {
-        GenericPK newPK = (GenericPK) genericPKFactory.object();
+        GenericPK newPK = genericPKFactory.object();
         newPK.init(modelEntity);
         return newPK;
     }
 
     /** Creates new GenericPK from existing Map */
-    public static GenericPK create(ModelEntity modelEntity, Map fields) {
-        GenericPK newPK = (GenericPK) genericPKFactory.object();
+    public static GenericPK create(ModelEntity modelEntity, Map<String, ? extends Object> fields) {
+        GenericPK newPK = genericPKFactory.object();
         newPK.init(modelEntity, fields);
         return newPK;
     }
 
     /** Creates new GenericPK from existing Map */
     public static GenericPK create(ModelEntity modelEntity, Object singlePkValue) {
-        GenericPK newPK = (GenericPK) genericPKFactory.object();
+        GenericPK newPK = genericPKFactory.object();
         newPK.init(modelEntity, singlePkValue);
         return newPK;
     }
 
     /** Creates new GenericPK from existing GenericPK */
     public static GenericPK create(GenericPK value) {
-        GenericPK newPK = (GenericPK) genericPKFactory.object();
+        GenericPK newPK = genericPKFactory.object();
         newPK.init(value);
         return newPK;
     }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java?rev=585832&r1=585831&r2=585832&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java Wed Oct 17 20:38:11 2007
@@ -45,57 +45,57 @@
 
     public static final GenericValue NULL_VALUE = new NullGenericValue();
 
-    protected static final ObjectFactory genericValueFactory = new ObjectFactory() {
-        protected Object create() {
+    protected static final ObjectFactory<GenericValue> genericValueFactory = new ObjectFactory<GenericValue>() {
+        protected GenericValue create() {
             return new GenericValue();
         }
     };
     
     /** Hashtable to cache various related entity collections */
-    public transient Map relatedCache = null;
+    public transient Map<String, List<GenericValue>> relatedCache = null;
 
     /** Hashtable to cache various related cardinality one entity collections */
-    public transient Map relatedOneCache = null;
+    public transient Map<String, GenericValue> relatedOneCache = null;
 
     /** This Map will contain the original field values from the database iff
      * this GenericValue came from the database. If it was made manually it will
      * no have this Map, ie it will be null to not take up memory.
      */
-    protected Map originalDbValues = null;
+    protected Map<String, Object> originalDbValues = null;
 
     protected GenericValue() { }
 
     /** Creates new GenericValue */
     public static GenericValue create(ModelEntity modelEntity) {
-        GenericValue newValue = (GenericValue) genericValueFactory.object();
+        GenericValue newValue = genericValueFactory.object();
         newValue.init(modelEntity);
         return newValue;
     }
 
     /** Creates new GenericValue from existing Map */
-    public static GenericValue create(ModelEntity modelEntity, Map fields) {
-        GenericValue newValue = (GenericValue) genericValueFactory.object();
+    public static GenericValue create(ModelEntity modelEntity, Map<String, ? extends Object> fields) {
+        GenericValue newValue = genericValueFactory.object();
         newValue.init(modelEntity, fields);
         return newValue;
     }
 
     /** Creates new GenericValue from existing Map */
     public static GenericValue create(ModelEntity modelEntity, Object singlePkValue) {
-        GenericValue newValue = (GenericValue) genericValueFactory.object();
+        GenericValue newValue = genericValueFactory.object();
         newValue.init(modelEntity, singlePkValue);
         return newValue;
     }
 
     /** Creates new GenericValue from existing GenericValue */
     public static GenericValue create(GenericValue value) {
-        GenericValue newValue = (GenericValue) genericValueFactory.object();
+        GenericValue newValue = genericValueFactory.object();
         newValue.init(value);
         return newValue;
     }
 
     /** Creates new GenericValue from existing GenericValue */
     public static GenericValue create(GenericPK primaryKey) {
-        GenericValue newValue = (GenericValue) genericValueFactory.object();
+        GenericValue newValue = genericValueFactory.object();
         newValue.init(primaryKey);
         return newValue;
     }
@@ -160,7 +160,7 @@
      *@param relationName String containing the relation name which is the combination of relation.title and relation.rel-entity-name as specified in the entity XML definition file
      *@return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelated(String relationName) throws GenericEntityException {
+    public List<GenericValue> getRelated(String relationName) throws GenericEntityException {
         return this.getDelegator().getRelated(relationName, this);
     }
 
@@ -170,8 +170,8 @@
      *      optionally add a " ASC" for ascending or " DESC" for descending
      *@return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelated(String relationName, List orderBy) throws GenericEntityException {
-        return this.getDelegator().getRelated(relationName, null, orderBy, this);
+    public List<GenericValue> getRelated(String relationName, List<String> orderBy) throws GenericEntityException {
+        return this.getDelegator().getRelated(relationName, FastMap.<String, Object>newInstance(), orderBy, this);
     }
 
     /** Get the named Related Entity for the GenericValue from the persistent store
@@ -181,7 +181,7 @@
      *      optionally add a " ASC" for ascending or " DESC" for descending
      *@return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelated(String relationName, Map byAndFields, List orderBy) throws GenericEntityException {
+    public List<GenericValue> getRelated(String relationName, Map<String, ? extends Object> byAndFields, List<String> orderBy) throws GenericEntityException {
         return this.getDelegator().getRelated(relationName, byAndFields, orderBy, this);
     }
 
@@ -190,7 +190,7 @@
      *@param relationName String containing the relation name which is the combination of relation.title and relation.rel-entity-name as specified in the entity XML definition file
      *@return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelatedCache(String relationName) throws GenericEntityException {
+    public List<GenericValue> getRelatedCache(String relationName) throws GenericEntityException {
         return this.getDelegator().getRelatedCache(relationName, this);
     }
 
@@ -205,7 +205,7 @@
      *      optionally add a " ASC" for ascending or " DESC" for descending
      * @return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelatedMulti(String relationNameOne, String relationNameTwo, List orderBy) throws GenericEntityException {
+    public List<GenericValue> getRelatedMulti(String relationNameOne, String relationNameTwo, List<String> orderBy) throws GenericEntityException {
         return this.getDelegator().getMultiRelation(this, relationNameOne, relationNameTwo, orderBy);
     }
 
@@ -218,7 +218,7 @@
      * @param relationNameTwo String containing the relation name for second relation
      * @return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelatedMulti(String relationNameOne, String relationNameTwo) throws GenericEntityException {
+    public List<GenericValue> getRelatedMulti(String relationNameOne, String relationNameTwo) throws GenericEntityException {
         return this.getDelegator().getMultiRelation(this, relationNameOne, relationNameTwo, null);
     }
 
@@ -230,8 +230,8 @@
      *      optionally add a " ASC" for ascending or " DESC" for descending
      *@return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelatedCache(String relationName, Map byAndFields, List orderBy) throws GenericEntityException {
-        List col = getRelatedCache(relationName);
+    public List<GenericValue> getRelatedCache(String relationName, Map<String, ? extends Object> byAndFields, List<String> orderBy) throws GenericEntityException {
+        List<GenericValue> col = getRelatedCache(relationName);
 
         if (byAndFields != null) col = EntityUtil.filterByAnd(col, byAndFields);
         if (UtilValidate.isNotEmpty(orderBy)) col = EntityUtil.orderBy(col, orderBy);
@@ -245,7 +245,7 @@
      *      optionally add a " ASC" for ascending or " DESC" for descending
      *@return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelatedCache(String relationName, List orderBy) throws GenericEntityException {
+    public List<GenericValue> getRelatedCache(String relationName, List<String> orderBy) throws GenericEntityException {
         return this.getRelatedCache(relationName, null, orderBy);
     }
 
@@ -255,9 +255,9 @@
      *@param relationName String containing the relation name which is the combination of relation.title and relation.rel-entity-name as specified in the entity XML definition file
      *@return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelatedEmbeddedCache(String relationName) throws GenericEntityException {
+    public List<GenericValue> getRelatedEmbeddedCache(String relationName) throws GenericEntityException {
         if (relatedCache == null) relatedCache = FastMap.newInstance();
-        List col = (List) relatedCache.get(relationName);
+        List<GenericValue> col = relatedCache.get(relationName);
 
         if (col == null) {
             col = getRelated(relationName);
@@ -275,8 +275,8 @@
      *      optionally add a " ASC" for ascending or " DESC" for descending
      *@return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelatedEmbeddedCache(String relationName, Map byAndFields, List orderBy) throws GenericEntityException {
-        List col = getRelatedEmbeddedCache(relationName);
+    public List<GenericValue> getRelatedEmbeddedCache(String relationName, Map<String, ? extends Object> byAndFields, List<String> orderBy) throws GenericEntityException {
+        List<GenericValue> col = getRelatedEmbeddedCache(relationName);
 
         if (byAndFields != null) col = EntityUtil.filterByAnd(col, byAndFields);
         if (UtilValidate.isNotEmpty(orderBy)) col = EntityUtil.orderBy(col, orderBy);
@@ -288,7 +288,7 @@
         relatedCache.remove(relationName);
     }
 
-    public void storeRelatedEmbeddedCache(String relationName, List col) {
+    public void storeRelatedEmbeddedCache(String relationName, List<GenericValue> col) {
         if (relatedCache == null) relatedCache = FastMap.newInstance();
         relatedCache.put(relationName, col);
     }
@@ -327,7 +327,7 @@
      */
     public GenericValue getRelatedOneEmbeddedCache(String relationName) throws GenericEntityException {
         if (relatedOneCache == null) relatedOneCache = FastMap.newInstance();
-        GenericValue value = (GenericValue) relatedOneCache.get(relationName);
+        GenericValue value = relatedOneCache.get(relationName);
 
         if (value == null) {
             value = getRelatedOne(relationName);
@@ -341,7 +341,7 @@
      *@param fields the fields that must equal in order to keep
      *@return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelatedByAnd(String relationName, Map fields) throws GenericEntityException {
+    public List<GenericValue> getRelatedByAnd(String relationName, Map<String, ? extends Object> fields) throws GenericEntityException {
         return this.getDelegator().getRelatedByAnd(relationName, fields, this);
     }
 
@@ -351,7 +351,7 @@
      *@param fields the fields that must equal in order to keep
      *@return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelatedByAndCache(String relationName, Map fields) throws GenericEntityException {
+    public List getRelatedByAndCache(String relationName, Map<String, ? extends Object> fields) throws GenericEntityException {
         return EntityUtil.filterByAnd(this.getDelegator().getRelatedCache(relationName, this), fields);
     }
 
@@ -362,7 +362,7 @@
      *@param fields the fields that must equal in order to keep
      *@return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelatedByAndEmbeddedCache(String relationName, Map fields) throws GenericEntityException {
+    public List getRelatedByAndEmbeddedCache(String relationName, Map<String, ? extends Object> fields) throws GenericEntityException {
         return EntityUtil.filterByAnd(getRelatedEmbeddedCache(relationName), fields);
     }
 
@@ -371,7 +371,7 @@
      *@param orderBy the order that they should be returned
      *@return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelatedOrderBy(String relationName, List orderBy) throws GenericEntityException {
+    public List<GenericValue> getRelatedOrderBy(String relationName, List<String> orderBy) throws GenericEntityException {
         return this.getDelegator().getRelatedOrderBy(relationName, orderBy, this);
     }
 
@@ -381,7 +381,7 @@
      *@param orderBy the order that they should be returned
      *@return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelatedOrderByCache(String relationName, List orderBy) throws GenericEntityException {
+    public List<GenericValue> getRelatedOrderByCache(String relationName, List<String> orderBy) throws GenericEntityException {
         return EntityUtil.orderBy(this.getDelegator().getRelatedCache(relationName, this), orderBy);
     }
 
@@ -392,7 +392,7 @@
      *@param orderBy the order that they should be returned
      *@return List of GenericValue instances as specified in the relation definition
      */
-    public List getRelatedOrderByEmbeddedCache(String relationName, List orderBy) throws GenericEntityException {
+    public List<GenericValue> getRelatedOrderByEmbeddedCache(String relationName, List<String> orderBy) throws GenericEntityException {
         return EntityUtil.orderBy(getRelatedEmbeddedCache(relationName), orderBy);
     }
 
@@ -420,7 +420,7 @@
      * @param byAndFields the fields that must equal in order to keep; may be null
      * @return GenericPK containing a possibly incomplete PrimaryKey object representing the related entity or entities
      */
-    public GenericPK getRelatedDummyPK(String relationName, Map byAndFields) throws GenericEntityException {
+    public GenericPK getRelatedDummyPK(String relationName, Map<String, ? extends Object> byAndFields) throws GenericEntityException {
         return this.getDelegator().getRelatedDummyPK(relationName, byAndFields, this);
     }
 
@@ -439,7 +439,7 @@
             ModelRelation relation = (ModelRelation) relItr.next();
             if ("one".equalsIgnoreCase(relation.getType())) {
                 // see if the related value exists                
-                Map fields = FastMap.newInstance();
+                Map<String, Object> fields = FastMap.newInstance();
                 for (int i = 0; i < relation.getKeyMapsSize(); i++) {
                     ModelKeyMap keyMap = relation.getKeyMap(i);
                     fields.put(keyMap.getRelFieldName(), this.get(keyMap.getFieldName()));