db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattba...@apache.org
Subject cvs commit: jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess PersistentNestedFieldMaxPerformanceImpl.java PersistentFieldPropertyImpl.java PersistentFieldDynaBeanImpl.java PersistentFieldFactory.java PersistentFieldDefaultImpl.java PersistentField.java PersistentFieldMaxPerformanceImpl.java
Date Fri, 20 Dec 2002 01:53:32 GMT
mattbaird    2002/12/19 17:53:32

  Modified:    src/java/org/apache/ojb/broker/metadata/fieldaccess
                        PersistentNestedFieldMaxPerformanceImpl.java
                        PersistentFieldPropertyImpl.java
                        PersistentFieldDynaBeanImpl.java
                        PersistentFieldFactory.java
                        PersistentFieldDefaultImpl.java
                        PersistentField.java
                        PersistentFieldMaxPerformanceImpl.java
  Log:
  add new "usesAccessorAndMutator" call so we can see if getters and setters would be used
  
  Revision  Changes    Path
  1.3       +4 -0      jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentNestedFieldMaxPerformanceImpl.java
  
  Index: PersistentNestedFieldMaxPerformanceImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentNestedFieldMaxPerformanceImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PersistentNestedFieldMaxPerformanceImpl.java	29 Nov 2002 19:35:07 -0000	1.2
  +++ PersistentNestedFieldMaxPerformanceImpl.java	20 Dec 2002 01:53:31 -0000	1.3
  @@ -180,4 +180,8 @@
           return result;
       }
   
  +	public boolean usesAccessorsAndMutators()
  +	{
  +		return false;
  +	}
   }
  
  
  
  1.4       +13 -1     jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldPropertyImpl.java
  
  Index: PersistentFieldPropertyImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldPropertyImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PersistentFieldPropertyImpl.java	29 Nov 2002 19:35:07 -0000	1.3
  +++ PersistentFieldPropertyImpl.java	20 Dec 2002 01:53:31 -0000	1.4
  @@ -75,6 +75,14 @@
   	private java.lang.Class declaringClass;
   	private String propertyName;
   	private transient java.beans.PropertyDescriptor propertyDescriptor;
  +	
  +	/**
  +	* Make the newInstace with no constructor call happy!
  +	*/
  +	public PersistentFieldPropertyImpl()
  +	{
  +
  +	}
   
   	public PersistentFieldPropertyImpl(Class aClass, String aPropertyName)
   	{
  @@ -291,4 +299,8 @@
   		return getDeclaringClass().getName() + "." + getPropertyName();
   	}
   
  +	public boolean usesAccessorsAndMutators()
  +	{
  +		return true;
  +	}
   }
  
  
  
  1.3       +6 -1      jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldDynaBeanImpl.java
  
  Index: PersistentFieldDynaBeanImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldDynaBeanImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PersistentFieldDynaBeanImpl.java	29 Nov 2002 19:35:07 -0000	1.2
  +++ PersistentFieldDynaBeanImpl.java	20 Dec 2002 01:53:31 -0000	1.3
  @@ -222,4 +222,9 @@
   			logger.error("anObject was null");
   		}
   	}
  +	
  +	public boolean usesAccessorsAndMutators()
  +	{
  +		return false;
  +	}
   }
  
  
  
  1.3       +31 -2     jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldFactory.java
  
  Index: PersistentFieldFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PersistentFieldFactory.java	29 Nov 2002 19:35:07 -0000	1.2
  +++ PersistentFieldFactory.java	20 Dec 2002 01:53:31 -0000	1.3
  @@ -69,7 +69,8 @@
   public class PersistentFieldFactory
   {
       private static Class persistentFieldClass = null;
  -
  +	private static boolean usesAccessorsAndMutators = false;
  +	private static boolean usesAccessorsAndMutatorsCheck = false;
       /**
        * @throws MetadataException if an erros occours when creating the PersistenteField
        */
  @@ -99,6 +100,34 @@
               throw new MetadataException("Error creating PersistentField: "+ attributeType.getName()
+ ", " + attributeName,ex);
           }
       }
  +
  +	public static boolean usesAccessorsAndMutators()
  +	{
  +		boolean retval = false;
  +		if (usesAccessorsAndMutatorsCheck)
  +			retval =  usesAccessorsAndMutators;
  +		else
  +		{
  +			Class clazz = getPersistentFieldClass();
  +			PersistentField field = null;
  +			try
  +			{
  +				field = (PersistentField) clazz.newInstance();
  +				usesAccessorsAndMutators = field.usesAccessorsAndMutators();
  +				retval = usesAccessorsAndMutators;
  +				usesAccessorsAndMutatorsCheck = true;
  +			}
  +			catch (InstantiationException e)
  +			{
  +				System.out.println("InstantiationException in usesAccessorsAndMutators " + e.getMessage());
  +			}
  +			catch (IllegalAccessException e)
  +			{
  +				System.out.println("IllegalAccessException error in usesAccessorsAndMutators " + e.getMessage());
  +			}
  +		}
  +		return retval;
  +	}
   
       private static Class getPersistentFieldClass()
       {
  
  
  
  1.12      +14 -1     jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldDefaultImpl.java
  
  Index: PersistentFieldDefaultImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldDefaultImpl.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PersistentFieldDefaultImpl.java	17 Dec 2002 19:00:39 -0000	1.11
  +++ PersistentFieldDefaultImpl.java	20 Dec 2002 01:53:32 -0000	1.12
  @@ -78,6 +78,14 @@
   	private String fieldname;
   	private Logger logger = LoggerFactory.getLogger(this.getClass());
   
  +	/**
  +	 * Make the newInstace with no constructor call happy!
  +	 */ 
  +	public PersistentFieldDefaultImpl()
  +	{
  +
  +	}
  +
   	public PersistentFieldDefaultImpl(Field f)
   	{
   		this.field = f;
  @@ -275,5 +283,10 @@
   			getField().setAccessible(true);
   			return null;
   		}
  +	}
  +	
  +	public boolean usesAccessorsAndMutators()
  +	{
  +		return false;
   	}
   }
  
  
  
  1.3       +4 -1      jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentField.java
  
  Index: PersistentField.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentField.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PersistentField.java	29 Nov 2002 19:35:07 -0000	1.2
  +++ PersistentField.java	20 Dec 2002 01:53:32 -0000	1.3
  @@ -88,4 +88,7 @@
   	 * @see java.lang.reflect.Field
   	 */
   	public Object get(Object anObject) throws MetadataException;
  +
  +	public boolean usesAccessorsAndMutators();
  +
   }
  
  
  
  1.12      +6 -1      jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldMaxPerformanceImpl.java
  
  Index: PersistentFieldMaxPerformanceImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/PersistentFieldMaxPerformanceImpl.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PersistentFieldMaxPerformanceImpl.java	17 Dec 2002 20:38:38 -0000	1.11
  +++ PersistentFieldMaxPerformanceImpl.java	20 Dec 2002 01:53:32 -0000	1.12
  @@ -228,4 +228,9 @@
   		}
   		return field;
   	}
  +
  +	public boolean usesAccessorsAndMutators()
  +	{
  +		return false;
  +	}
   }
  
  
  

Mime
View raw message