Documentation Archive Developer
Search
PATH Documentation > WebObjects

Table of Contents

NSCoding.Support


Inherits from:
Object
Package:
com.webobjects.foundation


Class Description


NSCoding.Support is an abstract class that defines a mechanism for one class to provide NSCoding behavior on behalf of another class. Subclasses of NSCoding.Support encode and decode objects of a different class. Subclasses of NSCoding.Support are needed to provide coding for classes whose code you don't own and that don't implement NSCoding.

For example, consider Java Client WebObjects applications that use NSCoding to distribute objects between client and server. Not all objects that Java Client distributes implement NSCoding (java.lang.String, for example). To encode and decode non-NSCoding objects, Java Client uses specialized subclasses of NSCoding.Support.


Note: Java Client has private subclasses of NSCoding.Support to encode and decode objects basic Java value classes such as java.lang.String, java.lang.Number, java.math.BigDecimal, and java.util.Date.

A subclass of NSCoding.Support should implement the methods encodeWithCoder and decodeObject to encode and decode objects of a specific non-NSCoding class. NSCoding.Support's implementations of these methods do nothing.

NSCoding.Support manages a registry of Support classes for classes that don't implement NSCoding. Use the methods setSupportForClass and supportForClass to register and access the NSCoding.Support classes for performing coding on non-NSCoding objects.




Constructors



NSCoding.Support

public NSCoding.Support()

The no-arg constructor. Don't use this method; because NSCoding.Support is an abstract class, you can never create an instance of it.


Static Methods



setSupportForClass

public static void setSupportForClass( NSCoding.Support supportClass, Class aClass)

Sets supportClass as the support class to use for coding instances of aClass.

supportForClass

public static NSCoding.Support supportForClass(Class aClass)

Returns the support class used for coding instances of aClass.


Instance Methods



classForCoder

public Class classForCoder(Object anObject)

Returns the class a coder should record as the class for anObject when anObject is encoded. NSCoding.Support's implementation simply returns anObject's actual class.

See Also: classForCoder ( NSCoding)



decodeObject

public abstract Object decodeObject(NSCoder aCoder)

Implemented by subclasses to decode an object of a specific type from the data in aCoder.

See Also: The NSCoding class description



encodeWithCoder

public abstract void encodeWithCoder( Object anObject, NSCoder aCoder)

Implemented by subclasses to encode an object of a specific type into aCoder.

See Also: encodeWithCoder ( NSCoding)



© 2001 Apple Computer, Inc. (Last Published April 17, 2001)


Table of Contents