The Foundation Framework
- Package:
- com.webobjects.foundation
Introduction
The Foundation Framework defines a base layer of classes written in Java. In addition to providing a set of useful primitive object classes, it introduces several paradigms that define functionality not covered by the Java language. The Foundation Framework is designed with these goals in mind:
- Provide a small set of basic utility classes
- Simplifies software development by introducing consistent conventions for things such as notifications, object persistence, key-value coding, and validation.
- Provide a level of OS independence, to enhance portability
This version of the Foundation framework is similar to the WebObjects 4.5 Foundation framework (com.apple.yellow.foundation) but does not rely on the Java Bridge because it is written in pure Java. The API for the pure Java Foundation also follows conventions in Sun's API more closely than the WebObjects 4.5 Foundation.
The pure Java Foundation resembles the WebObjects 4.5 Java Client Foundation (com.apple.client.foundation) but provides a larger set of functions.
Foundation Framework Classes
The Foundation Framework consists of several related groups of classes as well as a few individual classes:
- Data storage. NSData provides object-oriented storage for arrays of bytes. NSArray, NSDictionary, and NSSet provide storage for objects of any class.
- Dates and times. The NSTimestamp and NSTimeZone classes store times and dates. They offer methods for calculating date and time differences, for displaying dates and times in many formats, and for adjusting times and dates based on location in the world. The NSTimestampFormatter class converts dates to user-presentable strings and back.
- Application coordination and timing. NSNotification and NSNotificationCenter provide systems that an object can use to notify all interested observers of changes that occur. NSDelayedCallbackCenter coordinates events.
- Object distribution and persistence. The data that an object contains can be represented in an architecture-independent way using NSCoder and its subclasses, which also stores class information along with the data. The resulting representations are used for archiving and object distribution.
- Object disposal. The NSDisposable interface together with the NSDisposableRegistry ensure that unused objects are collected by Java's garbage collector.
- Key-value coding. The NSKeyValueCoding and NSKeyValueCodingAdditions interfaces along with their support classes provide a consistent way for objects to receive and return values for keys.
- Validation. The NSValidation interface and support classes define and implement a consistent validation mechanism.
- Locking of objects. The NSLock, NSRecursiveLock, and NSMultiReaderLock classes together with the NSLocking interface coordinate the locking of objects or graphs of objects.
- Operating system services. Several classes are designed to insulate you from the idiosyncracies of various operating systems. NSPathUtilities provides a consistent interface for working with file system paths. NSBundle accesses the application's resources.
- Other utility classes. NSRange specifies a range of values. NSComparator defines inequality relationships between objects for sorting. NSUndoManager manages an application's undo function. NSForwardException wraps exceptions into a subclass of Java's RuntimeException. NSPropertyListSerialization converts between property lists and byte arrays.
© 2001 Apple Computer, Inc. (Last Published April 17, 2001)