Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

The Foundation Framework

Package
com.apple.cocoa.foundation

Introduction

Important: The Java API for the Foundation framework is deprecated in Mac OS X version 10.4 and later. You should use the Objective-C API, documented in Foundation Framework Reference, to develop Cocoa applications.

The Foundation framework defines a base layer of Java classes. 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:

The Foundation framework includes the root object class, classes representing basic data types such as strings and byte arrays, collection classes for storing other objects, classes representing system information such as dates, and classes representing communication ports. See Figure I-1 for a list of those classes that make up the Foundation framework.

The Foundation framework introduces several paradigms to avoid confusion in common situations, and to introduce a level of consistency across class hierarchies. This consistency is done with some standard policies, such as that for object ownership (that is, who is responsible for disposing of objects), and with abstract classes like NSEnumerator. These new paradigms reduce the number of special and exceptional cases in an API and allow you to code more efficiently by reusing the same mechanisms with various kinds of objects.

Foundation Framework Classes

The Foundation class hierarchy is rooted in the Foundation framework’s NSObject class (see Figure I-1). The remainder of the Foundation framework consists of several related groups of classes as well as a few individual classes. NSStringReference and NSMutableStringReference, for example, act as brokers for instances of various subclasses optimized for different kinds of storage needs. Depending on the method you use to create a string, an instance of the appropriate optimized class will be returned to you.


Figure I-1  The Foundation framework class hierarchy

The Foundation framework class hierarchy


image: Art/java_foundation2.gif

Many of these classes have closely related functionality:



© 1997, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-07-24)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.