WebObjects 5.4.2

com.webobjects.eoaccess.synchronization
Class EOSchemaPropertyDescription

java.lang.Object
  extended by com.webobjects.eoaccess.synchronization.EOSchemaPropertyDescription
All Implemented Interfaces:
NSKeyValueCoding, NSKeyValueCodingAdditions
Direct Known Subclasses:
EOSchemaColumnDescription, EOSchemaForeignKeyConstraintDescription, EOSchemaIndexDescription, EOSchemaTableDescription

public abstract class EOSchemaPropertyDescription
extends Object
implements NSKeyValueCodingAdditions

Abstract implementation for objects to be used by schema synchronization. This must be subclassed in order to extend schema synchronization.

Since:
5.4
See Also:
EOSchemaTableDescription, EOSchemaColumnDescription, EOSchemaForeignKeyConstraintDescription, EOSchemaIndexDescription, EOSchemaSynchronizationFactory

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCoding
NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.MapImplementation, NSKeyValueCoding.Null, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.ValueAccessor
 
Field Summary
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
KeyPathSeparator
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
NullValue
 
Constructor Summary
protected EOSchemaPropertyDescription()
           
 
Method Summary
protected  void fieldsToString(StringBuilder aLog)
          Adds the fields for each subclass.
abstract  boolean isEmpty()
          Returns true is the property description is empty
 String name()
          Returns the name of that property.
protected  void setName(String value)
          Sets the name of this property
 void takeValueForKey(Object value, String key)
          Sets the value for the property identified by key to value.
 void takeValueForKeyPath(Object value, String key)
          Sets the value for the property identified by keyPath to value.
 String toString()
           
 Object valueForKey(String key)
          Retrieves the value of the property named by key.
 Object valueForKeyPath(String key)
          Retrieves the value of a property of the object at the end of the key path (a key path is a string of the form "key1.key2").
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EOSchemaPropertyDescription

protected EOSchemaPropertyDescription()
Method Detail

isEmpty

public abstract boolean isEmpty()
Returns true is the property description is empty

Returns:
true if empty

name

public String name()
Returns the name of that property.

Returns:
property name or empty string if not set

setName

protected void setName(String value)
Sets the name of this property

Parameters:
value - name of this property

valueForKey

public Object valueForKey(String key)
Description copied from interface: NSKeyValueCoding
Retrieves the value of the property named by key.

The default implementation provided by NSKeyValueCoding.DefaultImplementation works as follows:

  1. Searches for a public accessor method based on key. For example, with a key of "lastName", the method looks for a method named getLastName, lastName, or isLastName.
  2. If a public accessor method is not found, searches for a private accessor method based on key (a method preceded by an underbar). For example, with a key of "lastName", the method looks for a method named _getLastName, _lastName, or _isLastName
  3. If an accessor method is not found and the static method canAccessFieldsDirectly returns true, the method searches for a field based on key and returns its value directly. For the key "lastName", this would be _lastName, _isLastName, lastName, or isLastName.
  4. If neither an accessor method nor a field is found, the method invokes handleQueryWithUnboundKey (defined in NSKeyValueCoding.ErrorHandling).

Note: The default implementations have significant performance optimizations. To benefit from them, implement NSKeyValueCoding on a custom class as shown above by using the methods in NSKeyValueCoding.DefaultImplementation, or if your class inherits from an WebObjects class that implements NSKeyValueCoding, do not override the inherited implementation. Using a custom implementation incurs significant performance penalties.

Specified by:
valueForKey in interface NSKeyValueCoding
Parameters:
key - identifies the property to retrieve
Returns:
the value of the property identified by key. Depending on the object you invoke this method upon, null may be replaced with NullValue
See Also:
NSKeyValueCoding.NullValue, NSKeyValueCoding.takeValueForKey(java.lang.Object, java.lang.String), NSKeyValueCoding.DefaultImplementation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.ErrorHandling.handleQueryWithUnboundKey(java.lang.String)

takeValueForKey

public void takeValueForKey(Object value,
                            String key)
Description copied from interface: NSKeyValueCoding
Sets the value for the property identified by key to value.

The default implementation provided by NSKeyValueCoding.DefaultImplementation works as follows:

  1. Searches for a public accessor method of the form setKey, and invokes it if there is one.
  2. If a public accessor method is not found, searches for a private accessor method of the form _setKey, and invokes it if there is one.
  3. If an accessor method is not found and the static method canAccessFieldsDirectly returns true, searches for a field based on key and sets its value directly. For the key "lastName", this would be _lastName, _isLastName, lastName, or isLastName.
  4. If the type of the value argument is not compatible with the underlying field or method parameter, the default implementation will make an effort to convert between different Java numeric types (Integer, Double, BigDecimal, etc) as well as between Boolean and Number (true = 1, false = 0). If any other conversion would be necessary, an exception is thrown.
  5. If neither an accessor method nor a field is found, it is an error condition. It invokes handleTakeValueForUnboundKey if the object implements NSKeyValueCoding.ErrorHandling or throws NSKeyValueCoding.UnknownKeyException if the object does not.

Note: : The default implementations have significant performance optimizations. To benefit from them, implement NSKeyValueCoding on a custom class as shown above by using the methods in NSKeyValueCoding. DefaultImplementation, or if your class inherits from an WebObjects class that implements NSKeyValueCoding, do not override the inherited implementation. Using a custom implementation incurs significant performance penalties.

Specified by:
takeValueForKey in interface NSKeyValueCoding
Parameters:
value - the new value for the property named by key
key - identifies the property to change
See Also:
NSKeyValueCoding.NullValue, NSKeyValueCoding.valueForKey, NSKeyValueCoding.DefaultImplementation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.ErrorHandling.handleTakeValueForUnboundKey(java.lang.Object, java.lang.String)

valueForKeyPath

public Object valueForKeyPath(String key)
Description copied from interface: NSKeyValueCodingAdditions
Retrieves the value of a property of the object at the end of the key path (a key path is a string of the form "key1.key2"). A key path has the form relationship.property (with one or more relationships); for example "movieRole.roleName" or "movieRole.talent.lastName". The default implementation of this method (provided by NSKeyValueCodingAdditions.DefaultImplementation) gets the destination object for each relationship using valueForKey, and returns the result of a valueForKey message to the final object.

Specified by:
valueForKeyPath in interface NSKeyValueCodingAdditions
Parameters:
key - the keypath to evaluate
Returns:
the value for the derived property identified by keyPath
See Also:
NSKeyValueCoding.valueForKey(java.lang.String), NSKeyValueCodingAdditions.takeValueForKeyPath(java.lang.Object, java.lang.String), NSKeyValueCodingAdditions.DefaultImplementation

takeValueForKeyPath

public void takeValueForKeyPath(Object value,
                                String key)
Description copied from interface: NSKeyValueCodingAdditions
Sets the value for the property identified by keyPath to value. A key path has the form relationship.property (with one or more relationships); for example "movieRole.roleName" or "movieRole.talent.lastName". The default implementation of this method (provided by NSKeyValueCodingAdditions.DefaultImplementation) gets the destination object for each relationship using valueForKey, and sends the final object a takeValueForKey message with value and property.

Specified by:
takeValueForKeyPath in interface NSKeyValueCodingAdditions
Parameters:
value - the property identified by keyPath is set to this
key - identifies the property of an object
See Also:
NSKeyValueCoding.takeValueForKey(java.lang.Object, java.lang.String), NSKeyValueCodingAdditions.valueForKeyPath(java.lang.String), NSKeyValueCodingAdditions.DefaultImplementation

toString

public String toString()
Overrides:
toString in class Object

fieldsToString

protected void fieldsToString(StringBuilder aLog)
Adds the fields for each subclass. Subclasses must override this method and call super first if they have specific fields to display.

Parameters:
aLog - log statement being built

Last updated June 2008

Copyright © 2000-2008 Apple Inc.