WebObjects 5.2.3

com.webobjects.eodistribution.client
Class EOAttribute

java.lang.Object
  extended bycom.webobjects.eodistribution.client.EOAttribute
All Implemented Interfaces:
NSCoding

public class EOAttribute
extends Object
implements NSCoding

EOAttribute is the client-side representation of an attribute, containing the information relevant within Java Client. The corresponding server-side definition is also called EOAttribute, but exists in the package com.webobjects.eoaccess.

An EOAttribute represents a column, field, or property in a database and associates an internal name with an external name or expression by which the property is known to the database. The property an EOAttribute represents may be a meaningful value, such as a salary or a name, or it may be an arbitrary value used for identification but with no real-world applicability (ID numbers and foreign keys for relationships fall into this category). An EOAttribute also maintains type information for binding values to the instance variables of objects.

You usually define attributes in the EOModel with the EOModeler application. Your code probably won't need to interact programmatically with EOAttribute unless you are working at the adaptor level.


Nested Class Summary
 
Nested classes inherited from class com.webobjects.foundation.NSCoding
NSCoding.Support
 
Constructor Summary
EOAttribute()
          The constructor for EOAttribute.
 
Method Summary
 boolean allowsNull()
          Returns whether this attribute allows null values.
 Class classForCoder()
          Returns the class that will be used by NSCoders to later re-create this object.
static Object decodeObject(NSCoder coder)
          Decodes (re-creates) an EOAttribute from the information in the given coder.
 void encodeWithCoder(NSCoder coder)
          Encodes the information defining this EOAttribute into the given coder.
 String name()
          Returns the name of the attribute (within the model, not necessarily the same as on the database).
 String toString()
          Returns a readable String representation of this attribute's definitions.
 Object validateValue(Object value)
          Validates value by attempting to convert it to the attribute's value type and testing other attribute validation constraints (such as allowsNull, width, and so on).
 String valueClassName()
          Returns the name of the class which values of this attribute have, or null if no class is specified.
 int width()
          Returns the maximum length (in characters or bytes) for values that are mapped to this attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EOAttribute

public EOAttribute()
The constructor for EOAttribute.

Method Detail

allowsNull

public boolean allowsNull()
Returns whether this attribute allows null values.

Returns:
true if this attribute allows null values; falseotherwise

classForCoder

public Class classForCoder()
Returns the class that will be used by NSCoders to later re-create this object.

Specified by:
classForCoder in interface NSCoding
Returns:
the class that will be used by NSCoders to later re-create this object

decodeObject

public static Object decodeObject(NSCoder coder)
Decodes (re-creates) an EOAttribute from the information in the given coder.

Returns:
the re-created EOAttribute

encodeWithCoder

public void encodeWithCoder(NSCoder coder)
Encodes the information defining this EOAttribute into the given coder.

Specified by:
encodeWithCoder in interface NSCoding
Parameters:
coder - the NSCoder to be used for encoding
See Also:
NSCoder

name

public String name()
Returns the name of the attribute (within the model, not necessarily the same as on the database).

Returns:
the name of the attribute

toString

public String toString()
Returns a readable String representation of this attribute's definitions.

Returns:
the String representation

validateValue

public Object validateValue(Object value)
                     throws NSValidation.ValidationException
Validates value by attempting to convert it to the attribute's value type and testing other attribute validation constraints (such as allowsNull, width, and so on). Throws an exception if any errors occur during validation. On success, if no conversion was performed, returns null; if the validation process required coercion, the converted value is returned.

Parameters:
value - the object to be validated
Returns:
value, the converted value, or null
Throws:
NSValidation.ValidationException - if validation fails

valueClassName

public String valueClassName()
Returns the name of the class which values of this attribute have, or null if no class is specified.

Returns:
the name of the class for values

width

public int width()
Returns the maximum length (in characters or bytes) for values that are mapped to this attribute. Returns zero for numeric and date types.

Returns:
the maximum length (in characters or bytes) for values mapped to this attribute
See Also:
EOAttribute.setWidth(int)

Last updated Thu Oct 21 15:04:16 PDT 2004.

Copyright © 2004 Apple Computer, Inc.