net.sf.jldapbeans.lang
Class LdapClass

java.lang.Object
  extended by net.sf.jldapbeans.lang.LdapClass

public final class LdapClass
extends java.lang.Object

Representation of a jLDAPBeans' class.

The LdapClass is used as a LDAP bean instantiator. We can use it in many forms such as:

Version:
1.0 $ Revision 13-nov-2005 :: alonso $
Author:
A. Alonso Domínguez

Field Summary
static BeanRepository BEAN_REPOSITORY
           
 
Method Summary
static java.lang.Object aggregate(java.lang.Object obj, java.lang.Class<?>... classes)
          Aggregates an array of any kind of java classes to an LDAP bean instance.
static java.lang.Object aggregate(java.lang.Object obj, LdapClass... ldapClasses)
          Aggregates an array of any kind of LDAP classes to an LDAP bean instance.
static LdapClass classOf(java.lang.Object obj)
          Obtains a LdapClass instance for an object that may be a LDAP bean.
 boolean equals(java.lang.Object o)
           
static LdapClass forName(java.lang.String... objectClasses)
          Searches in BeanRepository for the names specified as objectClass maps each one as a java.lang.Class.
 java.lang.Class<?>[] getAbstractClasses()
          Obtains an array of java classes that reflect the ABSTRACT objectClasses used in this LdapClass
 java.lang.Class<?>[] getAuxiliaryClasses()
          Obtains an array of java classes that reflect the AUXILIARY objectClasses used in this LdapClass.
protected  java.lang.Class<?>[] getClasses()
          Accesses the class array used used inside this LdapClass instance.
 java.lang.Class<?>[] getStructuralClasses()
          Obtains an array of java classes that reflect the STRUCTURAL objectClasses used in this LdapClass.
 int hashCode()
           
static boolean isLdapBean(java.lang.Object obj)
          Identifies if a given object is an instance of an LdapJB
static LdapClass merge(java.lang.Class<?>... classes)
          Merges an array of any kind of java class into a LdapClass instance indentifying which of the classes received are valid LDAP bean classes.
static LdapClass merge(LdapClass... ldapClasses)
          Merges an array of instances of LdapClass
static LdapClass merge(LdapClass ldapClass, java.lang.Class<?>... classes)
          Merges a LdapClass instance with an array of any kind of java classes.
 java.lang.Object newInstance()
          Creates a new instance of a LDAP bean using a net.sf.cglib.proxy.Enhancer to support the implementation of every java class that the bean must support.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BEAN_REPOSITORY

public static final BeanRepository BEAN_REPOSITORY
Method Detail

aggregate

public static java.lang.Object aggregate(java.lang.Object obj,
                                         java.lang.Class<?>... classes)
                                  throws LdapClassException
Aggregates an array of any kind of java classes to an LDAP bean instance.

There is one thing that must be in mind of people who use this method to aggregate objectClasses to an already existent instance and that things is that the properties of the classes aggregated are not initialized by this method.

Parameters:
instance - An already existent instance of a LDAP bean.
classes - Any kind of java classes to be aggregated to the instance
Returns:
A new instance which is a copy of the one received but which has new properties received from the java classes aggregated.
Throws:
LdapClassException - If it is not possible aggregate classes.

aggregate

public static java.lang.Object aggregate(java.lang.Object obj,
                                         LdapClass... ldapClasses)
                                  throws LdapClassException
Aggregates an array of any kind of LDAP classes to an LDAP bean instance.

There is one thing that must be in mind of people who use this method to aggregate objectClasses to an already existent instance and that things is that the properties of the classes aggregated are not initialized by this method.

Parameters:
instance - An already existent instance of a LDAP bean.
classes - Any kind of LDAP classes to be aggregated to the instance
Returns:
A new instance which is a copy of the one received but which has new properties received from the java classes aggregated.
Throws:
LdapClassException - If it is not possible aggregate classes.

classOf

public static LdapClass classOf(java.lang.Object obj)
                         throws LdapClassException
Obtains a LdapClass instance for an object that may be a LDAP bean.

Parameters:
obj - The object where search for LDAP classes.
Returns:
A new LdapClass instance that represents the LDAP classes of the object specified.
Throws:
LdapClassException - If the object doesn't implement any LDAP class

forName

public static LdapClass forName(java.lang.String... objectClasses)
                         throws LdapClassException,
                                java.lang.ClassNotFoundException
Searches in BeanRepository for the names specified as objectClass maps each one as a java.lang.Class.

Parameters:
objectClasses - Array of objectClasses we need to search for.
Returns:
A new LdapClass instance that represents all the objectClasses specified.
Throws:
LdapClassException - If we can not found anyone of the objectClasses.
java.lang.ClassNotFoundException - If we can not fond anyone of the java classes.

isLdapBean

public static boolean isLdapBean(java.lang.Object obj)
Identifies if a given object is an instance of an LdapJB

Parameters:
obj - A possible LdapJB instance
Returns:
true if it's a bean; false otherwise.

merge

public static LdapClass merge(java.lang.Class<?>... classes)
                       throws LdapClassException
Merges an array of any kind of java class into a LdapClass instance indentifying which of the classes received are valid LDAP bean classes.

Parameters:
classes - An array of any kind of java class.
Returns:
A new instance of a LdapClass which will be conformant with the parameters received.
Throws:
LdapClassException - If there is not any valid LDAP bean class.

merge

public static LdapClass merge(LdapClass... ldapClasses)
                       throws LdapClassException
Merges an array of instances of LdapClass

Parameters:
beanClasses - A LdapClass array
Returns:
A new LdapClass that represents the LdapClasses received
Throws:
LdapClassException

merge

public static LdapClass merge(LdapClass ldapClass,
                              java.lang.Class<?>... classes)
                       throws LdapClassException
Merges a LdapClass instance with an array of any kind of java classes.

Parameters:
ldapClass - Any LdapClass instance
classes - An array of any kind of java classes
Returns:
A new instance of a LdapClass which will be an aggegation of ldapClass and the valid java classes found in the array
Throws:
LdapClassException - If the is not any valid LDAP bean class in the array.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

getAbstractClasses

public java.lang.Class<?>[] getAbstractClasses()
Obtains an array of java classes that reflect the ABSTRACT objectClasses used in this LdapClass

Returns:
An array of LdapJB interfaces

getAuxiliaryClasses

public java.lang.Class<?>[] getAuxiliaryClasses()
Obtains an array of java classes that reflect the AUXILIARY objectClasses used in this LdapClass.

Returns:
An array of LdapJB interfaces

getClasses

protected java.lang.Class<?>[] getClasses()
Accesses the class array used used inside this LdapClass instance.

Returns:
An array of LdapJB interfaces

getStructuralClasses

public java.lang.Class<?>[] getStructuralClasses()
Obtains an array of java classes that reflect the STRUCTURAL objectClasses used in this LdapClass.

Returns:
An array of LdapJB interfaces

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

newInstance

public java.lang.Object newInstance()
                             throws BeanInstantiationException
Creates a new instance of a LDAP bean using a net.sf.cglib.proxy.Enhancer to support the implementation of every java class that the bean must support.

Returns:
An instance of a LDAP bean.
Throws:
BeanInstantiationException - If some exception is catched during the instantiation process.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2005 jLDAPBeans Team. All Rights Reserved.