wt.introspection
Class RoleDescriptor

java.lang.Object
  extended bywt.introspection.RoleDescriptor
All Implemented Interfaces:
Externalizable, LocalizableMessage, Message, Serializable

public class RoleDescriptor
extends Object
implements LocalizableMessage, Externalizable

RoleDescriptor supplies meta-data information for a role of a Link (AssociationEnd).

Supported API: true

Extendable: false

See Also:
WTIntrospector, ClassInfo, LinkInfo, Serialized Form

Field Summary
private  String absoluteDir
           
static byte AGGREGATE
          

Supported API: false
static byte ASSOCIATION
          

Supported API: false
private  String associationName
           
private  boolean autoNavigate
           
private  boolean cascade
           
private  String classname
           
static byte COMPOSITE
          

Supported API: false
static boolean DEBUG
          

Supported API: false
private  boolean dependency
           
static long externalizationVersionUID
          Version identifier for managing compatibility and evolution of externalizable classes.
private  LinkInfo linkInfo
           
private  boolean localizable
           
private  byte maxCardinality
           
private  byte minCardinality
           
private  String name
           
private  boolean owner
           
private  Object[] params
           
private  byte roleType
           
(package private) static long serialVersionUID
           
static boolean TRACE
          

Supported API: false
private  Class validClass
           
private  ClassInfo validClassInfo
           
 
Constructor Summary
RoleDescriptor()
          Constructor.
RoleDescriptor(String association_name, String role_name, String role_class_name, byte role_type, byte min_cardinality, byte max_cardinality, boolean auto_navigate, boolean dependency, boolean isLocalizable, boolean isOwner, boolean isCascade)
          Constructor.
 
Method Summary
 boolean equals(Object compareRole)
          Equals is true if both sets of role names are the same, and either the link classes are type compatible, or both sets of role classes are type compatible, and the opposite side classes are not the same class.
 int getCardinality()
          Gets the cardinality (multiplicity) of this role.
 String getDisplayName()
          Gets the display name for this role descriptor.
 String getDisplayName(Locale locale)
          Gets the display name for this role, for the specified locale.
 LinkInfo getLinkInfo()
          Gets the LinkInfo that owns this role.
 String getLocalizedMessage(Locale locale)
          Gets the localized message for this role, for the specified locale.
 String getName()
          Gets the name of this Role.
 RoleDescriptor getOtherRole()
          Gets the other RoleDescriptor, for the association that owns them.
 Class getValidClass()
          Gets the valid class for this role.
 ClassInfo getValidClassInfo()
          Gets the valid ClassInfo for this role.
 boolean hasDisplayName()
          Deprecated.  
 boolean isAggregated()
          Determines if a class that plays this role in the association represents the "part" in an aggregation (whole-part) relationship.
 boolean isAutoNavigate()
          Determines if this role of the association will be automatically read from the database, along with the other side object.
 boolean isCascade()
          Determines if association deletion should cascade to the role object.
 boolean isComposed()
          Determines if a class that plays this role in the association represents the "owned" object in a composite aggregation.
 boolean isDependency()
          Determines if this class is a dependency of the opposite-side class.
 boolean isLocalizable()
          Deprecated.  
 boolean isMultiple()
          Determines if there can be multiple objects that play this role in a particular association.
 boolean isNavigable()
          Determines if this role of the association can be navigated to, from the object on the other side of the association.
 boolean isOptional()
          Determines if it is valid for no objects to play this role in a particular association.
 boolean isOwner()
          Determines if this role is an owner of the asociation.
 boolean isUnbounded()
          Determines if the number of objects that play this role in a particular association, is unlimited.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
(package private)  void setAbsoluteDir(String absolute_dir)
           
(package private)  void setAutoNavigate(boolean auto_navigate)
          Sets autoNavigate status.
 String toString()
          Returns a string representation of the object.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

externalizationVersionUID

public static final long externalizationVersionUID
Version identifier for managing compatibility and evolution of externalizable classes.

Supported API: false

See Also:
Constant Field Values

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

absoluteDir

private String absoluteDir

DEBUG

public static final boolean DEBUG


Supported API: false

See Also:
Constant Field Values

TRACE

public static final boolean TRACE


Supported API: false

See Also:
Constant Field Values

ASSOCIATION

public static final byte ASSOCIATION


Supported API: false

See Also:
Constant Field Values

AGGREGATE

public static final byte AGGREGATE


Supported API: false

See Also:
Constant Field Values

COMPOSITE

public static final byte COMPOSITE


Supported API: false

See Also:
Constant Field Values

name

private String name

roleType

private byte roleType

minCardinality

private byte minCardinality

maxCardinality

private byte maxCardinality

associationName

private String associationName

autoNavigate

private boolean autoNavigate

dependency

private boolean dependency

localizable

private boolean localizable

owner

private boolean owner

cascade

private boolean cascade

classname

private String classname

validClass

private transient Class validClass

validClassInfo

private transient ClassInfo validClassInfo

linkInfo

private transient LinkInfo linkInfo

params

private transient Object[] params
Constructor Detail

RoleDescriptor

public RoleDescriptor()
Constructor.

Supported API: false


RoleDescriptor

public RoleDescriptor(String association_name,
                      String role_name,
                      String role_class_name,
                      byte role_type,
                      byte min_cardinality,
                      byte max_cardinality,
                      boolean auto_navigate,
                      boolean dependency,
                      boolean isLocalizable,
                      boolean isOwner,
                      boolean isCascade)
Constructor.

Supported API: false

Method Detail

equals

public boolean equals(Object compareRole)
Equals is true if both sets of role names are the same, and either the link classes are type compatible, or both sets of role classes are type compatible, and the opposite side classes are not the same class.

Supported API: true

Returns:
true, if names match

getCardinality

public final int getCardinality()
Gets the cardinality (multiplicity) of this role.

Supported API: true

Returns:
cardinality of role

getDisplayName

public String getDisplayName()
Gets the display name for this role descriptor.

Supported API: true

Returns:
The display name string.
See Also:
getDisplayName(Locale)

getDisplayName

public String getDisplayName(Locale locale)
Gets the display name for this role, for the specified locale.

Supported API: true

Returns:
The display name string.

getLinkInfo

public LinkInfo getLinkInfo()
                     throws WTIntrospectionException
Gets the LinkInfo that owns this role.

Supported API: true

Returns:
The LinkInfo that owns this role.
Throws:
WTIntrospectionException

getLocalizedMessage

public String getLocalizedMessage(Locale locale)
Gets the localized message for this role, for the specified locale.

Supported API: true

Specified by:
getLocalizedMessage in interface LocalizableMessage
Parameters:
locale -
Returns:
The display name string.

getName

public final String getName()
Gets the name of this Role.

Supported API: true

Returns:
roleName as a String

getOtherRole

public RoleDescriptor getOtherRole()
                            throws WTIntrospectionException
Gets the other RoleDescriptor, for the association that owns them.

Supported API: true

Returns:
role from the other side of the link
Throws:
WTIntrospectionException - if cannot obtain LinkInfo

getValidClass

public Class getValidClass()
                    throws WTIntrospectionException
Gets the valid class for this role.

Supported API: false

Returns:
class (type) of the role
Throws:
WTIntrospectionException - if cannot load the class

getValidClassInfo

public ClassInfo getValidClassInfo()
                            throws WTIntrospectionException
Gets the valid ClassInfo for this role.

Supported API: true

Returns:
ClassInfo for the valid class of the role
Throws:
WTIntrospectionException - if cannot load the ClassInfo

hasDisplayName

public boolean hasDisplayName()
Deprecated.  

Supported API: false


isAggregated

public final boolean isAggregated()
Determines if a class that plays this role in the association represents the "part" in an aggregation (whole-part) relationship.

Supported API: true

Returns:
true if modeled as an aggregation

isAutoNavigate

public final boolean isAutoNavigate()
Determines if this role of the association will be automatically read from the database, along with the other side object.

Supported API: true

Returns:
true if role is automatically navigated (read from the database with the other side object)

isComposed

public final boolean isComposed()
Determines if a class that plays this role in the association represents the "owned" object in a composite aggregation.
 UML Definition of Composition -
 A form of aggregation with strong ownership and coincident lifetime
 as part of the whole. Parts with non-fixed multiplicity may be created
 after the composite itself, but once created they live and die with it
 (i.e., they share lifetimes). Such parts can also be explicitly removed
 before the death of the composite. Composition may be recursive.
  


Supported API: true

Returns:
true if modeled as a composition

isDependency

public final boolean isDependency()
Determines if this class is a dependency of the opposite-side class.

Supported API: true

Returns:
true if modeled as a dependency of the opposite-side class

isLocalizable

public boolean isLocalizable()
Deprecated.  

Supported API: false


isMultiple

public final boolean isMultiple()
Determines if there can be multiple objects that play this role in a particular association.

Supported API: true

Returns:
true if this role has multiple cardinality

isNavigable

public final boolean isNavigable()
Determines if this role of the association can be navigated to, from the object on the other side of the association.

Supported API: true

Returns:
true if this role is navaigable

isOptional

public final boolean isOptional()
Determines if it is valid for no objects to play this role in a particular association.

Supported API: true

Returns:
true if this role has optional cardinality

isUnbounded

public final boolean isUnbounded()
Determines if the number of objects that play this role in a particular association, is unlimited.

Supported API: true

Returns:
true if this role has unbounded cardinality

isOwner

public boolean isOwner()
Determines if this role is an owner of the asociation. Owner means when theis role is deleted, the association will be deleted also. Both roles can be an owner.

Supported API: false

Returns:
a boolean indicating if this role is an owner.

isCascade

public boolean isCascade()
Determines if association deletion should cascade to the role object.

Supported API: false

Returns:
a boolean indicating if association deletions should cascade.

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input - is an input stream
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output - is an output stream
Throws:
IOException

toString

public String toString()
Returns a string representation of the object.

Supported API: true

Returns:
a string representation of the object.

setAutoNavigate

void setAutoNavigate(boolean auto_navigate)
Sets autoNavigate status. To be used when it is inherited from an overriden association Role.


setAbsoluteDir

void setAbsoluteDir(String absolute_dir)