Class PersistenceDescriptor

  • All Implemented Interfaces:
    Serializable

    public final class PersistenceDescriptor
    extends Descriptor
    This class contains information about the persistent state (abstract persistence schema) for EJB2.0 CMP EntityBeans and Join Objects.
    Author:
    Sanjeev Krishnan
    See Also:
    Serialized Form
    • Constructor Detail

      • PersistenceDescriptor

        public PersistenceDescriptor()
      • PersistenceDescriptor

        public PersistenceDescriptor​(PersistenceDescriptor pers)
        The copy constructor.
    • Method Detail

      • getCMRFieldReturnType

        public String getCMRFieldReturnType​(String field)
      • classesChanged

        public boolean classesChanged()
        Called from EjbCMPEntityDescriptor when some classes in this object are updated.
      • getParentDescriptor

        public Descriptor getParentDescriptor()
      • getRelationships

        public Set getRelationships()
        Get all CMR fields of this bean. All relationships are stored in EjbBundleDescriptor to avoid the complexity of keeping the two sets consistent. NOTE : To add or remove a relationship use EjbBundleDescriptor.
      • getCMRFieldInfo

        public CMRFieldInfo[] getCMRFieldInfo()
        Return array of CMRFieldInfo objects for all CMR fields.
      • getCMRFieldInfoByName

        public CMRFieldInfo getCMRFieldInfoByName​(String fieldName)
        Return the CMRFieldInfo object for the given CMR field
      • invalidate

        public void invalidate()
        Ensures that persistence descriptor will regenerate its derived information after changes have been made to persistent characteristics.
      • clearCMPFields

        public void clearCMPFields()
      • addCMPField

        public void addCMPField​(String field)
      • removeCMPField

        public void removeCMPField​(String field)
      • removeCMPField

        public void removeCMPField​(FieldDescriptor fieldDesc)
      • setCMPFields

        public void setCMPFields​(Set cmpFields)
        Set the FieldDescriptor objects that the EJB container will persist for this bean.
      • isCMPField

        public boolean isCMPField​(String field)
        Has the supplied field object been deemed persistent.
      • getCMPFields

        public Set<FieldDescriptor> getCMPFields()
        Return the Set of fields deemed persistent. The elements of this Set are FieldDescriptor objects. This Set should be modified by calling addCMPField, removeCMPField
      • setPkeyFields

        public void setPkeyFields​(Set pkeyFields)
        Set the FieldDescriptor objects for primary key fields for this bean.
      • getPkeyFields

        public Set getPkeyFields()
        Return the Set of primary key fields. The elements of this Set are FieldDescriptor objects. This Set can be modified by calling addPkeyField, removePkeyField
      • isPkeyField

        public boolean isPkeyField​(String field)
        Is the supplied field object one of the pkey fields.
      • primaryKeyIsOneField

        public boolean primaryKeyIsOneField()
        Returns:
        true if the primary key of this object is one field in its class and the type of the field is not a primitive type. True for EJBs if the primkey-field deployment descriptor element is specified, or if a container-inserted pk field is used.
      • primaryKeyIsSpecified

        public boolean primaryKeyIsSpecified()
        Returns:
        false if the primkey-field is not specified and pk class = Object
      • primaryKeyFieldsAllPrimitive

        public boolean primaryKeyFieldsAllPrimitive()
        Returns:
        true if the primkey-field is not specified all fields of pkey class are Java primitive types.
      • getPrimaryKeyClass

        public Class getPrimaryKeyClass()
        Get this bean's primary key class. For EJBs, this is EjbEntityDescriptor.getPrimaryKeyClassName(),
      • getPersistentClass

        public Class getPersistentClass()
      • getStateClass

        public Class getStateClass()
      • setFkeyFields

        public void setFkeyFields​(PersistentFieldInfo[] fkeyFields)
        Set the array of PersistentFieldInfo objects representing the foreign key fields of this bean.
      • getFkeyFields

        public PersistentFieldInfo[] getFkeyFields()
        Return the array of PersistentFieldInfo objects for the foreign key fields of this bean.
      • getPersistentFieldInfo

        public PersistentFieldInfo[] getPersistentFieldInfo()
        Return the array of PersistentFieldInfo objects for the CMP + foreign key fields
      • getPersistentFieldInfoByName

        public PersistentFieldInfo getPersistentFieldInfoByName​(String fieldName)
        Return the PersistentFieldInfo object for the given CMP/fkey field
      • getNonPkeyPersFieldInfo

        public PersistentFieldInfo[] getNonPkeyPersFieldInfo()
        Return the array of PersistentFieldInfo objects for the CMP fields which are not primary keys + foreign key fields.
      • getPkeyFieldInfo

        public PersistentFieldInfo[] getPkeyFieldInfo()
        Return the array of PersistentFieldInfo objects for the pkey fields.
      • getPkeyFieldInfoByName

        public PersistentFieldInfo getPkeyFieldInfoByName​(String fieldName)
        Return PersistentFieldInfo object for the given pkey field.
      • getPkeyClassFields

        public Field[] getPkeyClassFields()
        Returns:
        an array of all Field objects in the primary key class. Returns null if primaryKeyIsOneField() == true.
      • getTypeFor

        public Class getTypeFor​(String field)
        Returns:
        the Class object corresponding to the type of the given CMP field.
      • capitalize

        public static String capitalize​(String name)
      • getQueriedMethods

        public Set getQueriedMethods()
        Get all methods for which setQueryFor was done
        Returns:
        a Set of Methods
      • getAllPossibleQueriedMethods

        public Set getAllPossibleQueriedMethods()
        Get all HomeIntf.find* and EJBClass.ejbSelect* methods for which an EJB-QL query could possibly be set.
        Returns:
        a Set of Methods
      • print

        public void print​(StringBuilder toStringBuilder)
        Return my formatted string representation.
        Overrides:
        print in class Descriptor