com.webobjects.foundation
Class NSCoding.Support
java.lang.Object
|
+--com.webobjects.foundation.NSCoding.Support
- Enclosing class:
- NSCoding
- public abstract static class NSCoding.Support
- extends Object
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 (private) subclasses of NSCoding.Support.
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 default implementations of
these methods do nothing.
NSCoding.Support manages a registry of Support classes for classes
that don't implement NSCoding. The methods setSupportForClass
and supportForClass
are used to register and access the NSCoding.Support
classes for performing coding on non-NSCoding objects. There is pre-register list of
NSCoding.Support classes for the following types:
- String
- Boolean
- Number
- Byte
- Short
- Integer
- Long
- Float
- Double
- BigInteger
- BigDecimal
- Date
- Charater
- See Also:
NSCoding.encodeWithCoder(NSCoder coder)
,
decodeObject(NSCoder aCoder)
,
setSupportForClass(NSCoding.Support supportClass, Class aClass)
,
supportForClass(Class aClass)
,
NSCoding
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NSCoding.Support
public NSCoding.Support()
classForCoder
public Class classForCoder(Object receiver)
- NSCoding.Support's default implementation simply returns
receiver
's actual class.
- Parameters:
receiver
- the object being encoded- Returns:
- the class a coder should record as the class for
receiver
when receiver
is encoded. - See Also:
NSCoding.classForCoder()
decodeObject
public abstract Object decodeObject(NSCoder coder)
- Implemented by subclasses to decode an object of a specific type
from the data in
coder
.
- Parameters:
coder
- an NSCoder object that will be used to decode an object out of its data- Returns:
- the decoded object
- See Also:
NSCoding
encodeWithCoder
public abstract void encodeWithCoder(Object receiver,
NSCoder coder)
- Implemented by subclasses to encode an object
receiver
of a specific
type using NSCoder coder
.
- Parameters:
receiver
- the object being encodedcoder
- an NSCoder object that will be used to encode receiver
- See Also:
NSCoding.encodeWithCoder(NSCoder coder)
setSupportForClass
public static void setSupportForClass(NSCoding.Support support,
Class aClass)
- Sets
support
as the NSCoding.Support class to use for encoding and
decoding instances of aClass
.
- Parameters:
support
- the NSCoding.Support class to be registered for aClass
aClass
- class whose instances are to be encoded or decoded
supportForClass
public static NSCoding.Support supportForClass(Class aClass)
- Gets the registered NSCoding.Support class to encode and decode instances of
aClass
.
- Parameters:
aClass
- class whose instances are to be encoded or decoded- Returns:
- the NSCoding.Support class if such a class is registered for
aClass
or null
otherwise
Copyright © 2003 Apple Computer, Inc.