com.webobjects.foundation
Interface NSKeyValueCodingAdditions
- All Superinterfaces:
- NSKeyValueCoding
- All Known Subinterfaces:
- EOEnterpriseObject, EOKeyValueCodingAdditions
- All Known Implementing Classes:
- com.webobjects.eocontrol._EOCheapCopyArray, com.webobjects.eocontrol._EOCheapCopyMutableArray, com.webobjects.eogeneration.assistant._EOEditorExplanation, com.webobjects.eogeneration.assistant._EOEditorSelectionValueCustomizer, com.webobjects.eogeneration.assistant._EOEditorStringAddition, com.webobjects.eogeneration.assistant._EOEditorStringList, com.webobjects.eogeneration.assistant._EOEditorStringList._Object, com.webobjects.eogeneration.assistant._EOEditorStringSelector, com.webobjects.eogeneration.assistant._EOEditorStringValueCustomizer, com.webobjects.eogeneration.assistant._EOEditorValueCustomizer, com.webobjects.eogeneration.rules._EOErrorWindow, com.webobjects.eocontrol._EOFlatMutableDictionary, com.webobjects.eodistribution._EOHTTPInitialAction, com.webobjects.eocontrol._EOMutableDefaultValueDictionary, com.webobjects.eocontrol._EOMutableKnownKeyDictionary, com.webobjects.eodistribution._EOWebStartAction, com.webobjects.appserver._WOSimpleApplication, com.webobjects.webservices.generation._WSDirectAction, BASConfirmPage, BASDefaultHeader, BASEditRelationshipPage, BASErrorPage, BASHead, BASInspectPage, BASListPage, BASMasterDetailPage, BASPlainListPage, BASQueryAllEntitiesPage, BASQueryPage, BASSideHeader, BASSidePageWrapper, D2WActions, D2WCollapsibleComponentContent, D2WCompactInspectComponent, D2WComponent, D2WConfirmPage, D2WContext, D2WCustomComponent, D2WCustomQueryComponent, D2WDefaultCustomComponent, D2WDisplayBoolean, D2WDisplayDate, D2WDisplayHyperlink, D2WDisplayImage, D2WDisplayImageFromPath, D2WDisplayLargeString, D2WDisplayMailTo, D2WDisplayNumber, D2WDisplayString, D2WDisplayStyledDate, D2WDisplayStyledNumber, D2WDisplayStyledString, D2WDisplayThresholdColoredNumber, D2WDisplayToMany, D2WDisplayToMany2, D2WDisplayToManyBrowser, D2WDisplayToManyFault, D2WDisplayToManyTable, D2WDisplayToOne, D2WDisplayToOneFault, D2WEdit, D2WEditBoolean, D2WEditDate, D2WEditLargeString, D2WEditNumber, D2WEditRelationshipPage, D2WEditString, D2WEditToManyFault, D2WEditToManyRelationship, D2WEditToOneFault, D2WEditToOneRelationship, D2WEditUneditable, D2WEmbeddedComponent, D2WEmptyWrapper, D2WErrorPage, D2WGenerationWrapper, D2WHead, D2WInspect, D2WInspectPage, D2WKeyPathContainer, D2WList, D2WListPage, D2WMasterDetailPage, D2WPage, D2WPlainListPage, D2WQuery, D2WQueryAllEntitiesPage, D2WQueryAnyField, D2WQueryBoolean, D2WQueryDateOperator, D2WQueryDateRange, D2WQueryNumberOperator, D2WQueryNumberRange, D2WQueryPage, D2WQueryRangeComponent, D2WQueryRelationship, D2WQueryStringComponent, D2WQueryStringOperator, D2WQueryToManyField, D2WQueryToManyRelationship, D2WQueryToOneField, D2WQueryToOneRelationship, D2WQueryUnavailable, D2WRemoteControl, D2WSelect, D2WStandAloneWebAssistantFrame, D2WStatelessComponent, D2WSwitchComponent, D2WTabInspectPage, D2WWebAssistantFrame, D2WWebAssistantPage, DarwinShadow, DefaultHeader, EditComponent, EditRelationship, EOActionButtonsController, EOActionButtonsController, EOActionController, EOActionController, EOActionMenuController, EOActionMenuController, EOActions, EOActionTrigger, EOActionTrigger, EOActionWidgetController, EOAppletController, EOApplication, EOArchiveController, EOAssistant, EOAssistantActions, EOAssociationController, EOAvailableSpecifications, EOBoxController, EOBoxController, EOCheckBoxController, EOCheckBoxController, EOComboBoxController, EOComboBoxController, EOComponentController, EOComponentController, EOController, EOController, EOCustomObject, EODefaultActionTrigger, EODefaultSpecifications, EODetailSelectionController, EODetailSelectionController, EODialogController, EODialogController, EODisplayStatisticsController, EODisplayStatisticsController, EODocumentController, EODynamicApplication, EOEditingController, EOEditor, EOEntitiesEditor, EOEntityController, EOEntityController, EOEnumerationController, EOEnumerationWindow, EOForm, EOFormatValueController, EOFormController, EOFormController, EOFormElement, EOFrameController, EOFrameController, EOGenericRecord, EOHelpWindowAction, EOImageViewController, EOImageViewController, EOInsertAction, EOInspectorController, EOInspectorController, EOInterfaceController, EOList, EOListAction, EOListController, EOListController, EOMenuSwitchController, EOMenuSwitchController, EOMiscellaneousEditor, EOModalDialog, EOModalDialogController, EOModalDialogController, EOMultipleValuesEnumerationController, EOMultipleValuesEnumerationController, EOOneValueEnumerationController, EOOneValueEnumerationController, EOOpenAction, EOProgrammaticSwitchController, EOProgrammaticSwitchController, EOPropertiesEditor, EOPropertyKeys, EOQuery, EOQueryAction, EOQueryController, EOQueryController, EOQueryWindow, EOQuickTimeViewController, EOQuickTimeViewController, EORangeTextFieldController, EORangeTextFieldController, EORangeValueController, EORangeWidgetController, EORuleComponent, EOSchemaColumnDescription, EOSchemaForeignKeyConstraintDescription, EOSchemaIndexDescription, EOSchemaPropertyDescription, EOSchemaSynchronizationChanges, EOSchemaSynchronizationColumnChanges, EOSchemaSynchronizationModelChanges, EOSchemaSynchronizationTableChanges, EOSchemaTableDescription, EOSelect, EOSelectForm, EOSimpleWindowController, EOSpecification, EOSplitController, EOSplitController, EOStandardApplicationAction, EOStandardControllerHierarchyAction, EOStandardWindowObserverAction, EOStaticIconController, EOStaticIconController, EOStaticLabelController, EOStaticLabelController, EOStaticTextFieldController, EOStaticTextFieldController, EOStringArray, EOStringDictionary, EOSubform, EOSwitchController, EOTableColumnController, EOTableColumnController, EOTableController, EOTableController, EOTabSwitchController, EOTabSwitchController, EOTextAreaController, EOTextAreaController, EOTextFieldController, EOTextFieldController, EOTitlesController, EOToolWindowAction, EOTreeController, EOTreeController, EOUserInterfaceParameters, EOUserInterfaceParametersEditor, EOValueAndURLController, EOValueController, EOWidgetController, EOWidgetParametersEditor, EOWindow, EOWindowAction, EOWindowController, EOWindowParametersEditor, EOXMLComponent, EOXMLEditor, com.webobjects.eogeneration.assistant.EOXMLEditor._DisplayObject, FrontbasePlugIn.FrontbaseSynchronizationFactory.FrontbaseColumnDescription, FrontbasePlugIn.FrontbaseSynchronizationFactory.FrontbaseIndexDescription, FrontbasePlugIn.FrontbaseSynchronizationFactory.FrontbaseTableDescription, JSAlertPanel, JSComponent, JSConfirmPanel, JSImageFlyover, JSModalWindow, JSTextFlyover, JSValidatedField, NEUCompactInspectComponent, NEUConfirmPage, NEUEditRelationshipPage, NEUErrorPage, NEUHeader, NEUInspectPage, NEUListPage, NEUMasterDetailPage, NEUPlainListPage, NEUQueryAllPage, NEUQueryPage, NEUTabInspectPage, NSArray, NSDictionary, NSMutableArray, NSMutableDictionary, OpenBasePlugIn.OpenBaseSynchronizationFactory.OpenBaseColumnDescription, OpenBasePlugIn.OpenBaseSynchronizationFactory.OpenBaseIndexDescription, OpenBasePlugIn.OpenBaseSynchronizationFactory.OpenBaseTableDescription, QueryComponent, QueryOperatorComponent, WOAdminAction, WOAggregateEventRow, WOAnyField, WOApplication, WOAssociationEventRow, WOBatchNavigationBar, WOBeginTransactionOperation, WOCheckboxMatrix, WOCollapsibleComponentContent, WOCommitTransactionOperation, WOCompletionBar, WOComponent, WOContext, WOCookie, WODeleteOperation, WODictionaryRepetition, WODirectAction, WOEventDisplay, WOEventDisplayPage, WOEventPage, WOEventRow, WOEventSetup, WOEventSetupPage, WOExceptionPage, WOFetchSpecSearchOperation, WOHTTPConnection, WOIFrame, WOInsertOperation, WOJavaClientApplet, WOJavaClientComponent, WOJavaClientJNLP, WOKeyValueConditional, WOLCompactInspectComponent, WOLConfirmPage, WOLEditRelationshipPage, WOLErrorPage, WOLHeader, WOLInspectPage, WOLListPage, WOLMasterDetailPage, WOLongResponsePage, WOLPlainListPage, WOLQueryAllPage, WOLQueryPage, WOLTabInspectPage, WOMessage, WOMetaRefresh, WOOperation, WOOperationWSDLTemplate, WOPageRestorationError, WOProjectBuilderAction, WORadioButtonMatrix, WORedirect, WORequest, WOResponse, WORollbackTransactionOperation, WOSearchOperation, WOServletContext, WOSession, WOSessionCreationError, WOSessionRestorationError, WOSimpleArrayDisplay, WOSimpleArrayDisplay2, WOSortOrder, WOSortOrderManyKey, WOStatisticsStore, WOStats, WOStatsPage, WOStringKeyMap, WOTable, WOTableString, WOTabPanel, WOThresholdColoredNumber, WOToManyRelationship, WOToOneRelationship, WOUpdateOperation, WOWSDLGeneration, WXAccessControl, WXBar, WXOutlineControl, WXOutlineEntry, WXOutlineRepetition, WXSortOrder
public interface NSKeyValueCodingAdditions
- extends NSKeyValueCoding
The NSKeyValueCodingAdditions interface defines an
extension to the basic NSKeyValueCoding interface. The pair of
methods in NSKeyValueCodingAdditions -- takeValueForKeyPath
and
valueForKeyPath
-- give access to properties across relationships
with key paths of the form relationship.property;
for example, "department.name".
The NSKeyValueCodingAdditions interface contains two
inner classes, NSKeyValueCodingAdditions.DefaultImplementation
and NSKeyValueCodingAdditions.Utility. The former provides a
default implementation of the interface, making it easy to
implement custom classes. The latter is a convenience
class that allows you to access the properties of
NSKeyValueCodingAdditions
objects and objects using the same code.
Default Implementation
The methods in the NSKeyValueCodingAdditions.DefaultImplementation
class are just like the methods defined by the NSKeyValueCodingAdditions
interface, except they are static methods and they take an extra
argument -- the object on which the default implementation should operate.
For example, suppose it is wanted to implement an Employee class
that implements NSKeyValueCodingAdditions using
NSKeyValueCodingAdditions.DefaultImplementation. Employee's
valueForKeyPath method would then look like this:
public Object valueForKeyPath(String keyPath) {
return NSKeyValueCodingAdditions.DefaultImplementation.valueForKeyPath(
this, keyPath);
}
Utility
Recall that the NSKeyValueCodingAdditions.Utility class is a
convenience that allows to access the properties of
NSKeyValueCodingAdditions objects and non-NSKeyValueCodingAdditions
objects using the same code.
Utility's methods are similar to DefaultImplementation's methods in
that they are static methods and they take an extra argument -- the object
on which the method should operate. However, Utility's methods simply
check to see if the object on which they operate is an
NSKeyValueCodingAdditions object and invoke the corresponding
NSKeyValueCodingAdditions method on the object if it is. Otherwise,
they invoke the corresponding DefaultImplementation method, passing the
object on which to operate.
For example, suppose that you want to access an object with the
NSKeyValueCodingAdditions API but you do not know if the object is an
NSKeyValueCodingAdditions object. To do so, you simply use the corresponding
Utility API, as in the following line of code:
theValue = NSKeyValueCodingAdditions.Utility.valueForKeyPath(object, keyPath);
The above line of code is essentially a short-cut for the following:
if (object instanceof NSKeyValueCodingAdditions) {
theValue = ((NSKeyValueCodingAdditions)object).valueForKeyPath(keyPath);
} else {
theValue = NSKeyValueCodingAdditions.DefaultImplementation.valueForKeyPath(
object, keyPath);
}
- See Also:
takeValueForKeyPath(java.lang.Object, java.lang.String)
,
valueForKeyPath(java.lang.String)
,
NSKeyValueCoding
,
NSKeyValueCodingAdditions.DefaultImplementation
,
NSKeyValueCodingAdditions.Utility
Nested Class Summary |
static class |
NSKeyValueCodingAdditions.DefaultImplementation
The NSKeyValueCodingAdditions.DefaultImplementation class
provides default implementations of the NSKeyValueCodingAdditions
interface. |
static class |
NSKeyValueCodingAdditions.Utility
The NSKeyValueCodingAdditions.Utility class is a convenience
that allows one to access the properties of NSKeyValueCodingAdditions
objects and non-NSKeyValueCodingAdditions objects using the
same code. |
Method Summary |
void |
takeValueForKeyPath(Object value,
String keyPath)
Sets the value for the property identified by keyPath
to value . |
Object |
valueForKeyPath(String keyPath)
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"). |
KeyPathSeparator
static final String KeyPathSeparator
- The string used to separate components of a key path, "."
- See Also:
- Constant Field Values
valueForKeyPath
Object valueForKeyPath(String keyPath)
- 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.
- Parameters:
keyPath
- the keypath to evaluate
- Returns:
- the value for the derived property identified by
keyPath
- See Also:
NSKeyValueCoding#valueForKey
,
takeValueForKeyPath(java.lang.Object, java.lang.String)
,
NSKeyValueCodingAdditions.DefaultImplementation
takeValueForKeyPath
void takeValueForKeyPath(Object value,
String keyPath)
- 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
.
- Parameters:
value
- the property identified by keyPath
is set to thiskeyPath
- identifies the property of an object- See Also:
NSKeyValueCoding#takeValueForKey
,
valueForKeyPath(java.lang.String)
,
NSKeyValueCodingAdditions.DefaultImplementation
Copyright © 2000-2007 Apple Inc.