FileDocCategorySizeDatePackage
TypeData.javaAPI DocGlassfish v2 API5407Fri May 04 22:23:42 BST 2007com.sun.enterprise.management.support

TypeData

public class TypeData extends Object
Basic data from which we derive all our TypeInfo. Any j2eeType must either have 1 or more legal parent types ( in which case it is a subType), or must have a contained-by j2eeType (possibly null), in which case it is a top-level type, possibly contained by something else.

Separating these two ideas enables reasonably short types that don't have to artifically include the singletons they are logically contained in. For example, it enables the type "X-ConfigConfig" instead of "X-DomainRoot.X-DomainConfig.X-ConfigConfig", which is considerably longer than (unnecessarily so).

Fields Summary
private final String
mJ2EEType
private final Set
mLegalParentsTypes
private final String
mContainedByJ2EEType
Constructors Summary
protected TypeData(String j2eeType, String parentJ2EEType)
Same as TypeData( j2eeType, newSet( parentJ2EEType ) )

		this( j2eeType, Collections.singleton( parentJ2EEType ) );
	
protected TypeData(String j2eeType, Set legalParentJ2EETypes)

param
j2eeType the j2eeType
param
legalParentJ2EETypes the possible j2eeTypes of the parent (0 or more)

		this( j2eeType, legalParentJ2EETypes, null );
	
protected TypeData(String j2eeType, Set legalParentJ2EETypes, String containedByJ2EEType)

param
j2eeType the j2eeType
param
legalParentJ2EETypes the possible j2eeTypes of the parent (0 or more)
param
containingJ2EEType if non-null, the containing type, legalParentJ2EETypes must be null

		if ( containedByJ2EEType != null && legalParentJ2EETypes != null )
		{
			throw new IllegalArgumentException( "can't have both parents and contained type" );
		}
		
		mJ2EEType				= j2eeType;
		if ( containedByJ2EEType != null )
		{
			mContainedByJ2EEType	= containedByJ2EEType;
			mLegalParentsTypes		= null;
		}
		else
		{
			mContainedByJ2EEType	= null;
			mLegalParentsTypes		= legalParentJ2EETypes == null ?
					null : Collections.unmodifiableSet( legalParentJ2EETypes );
		}
	
Methods Summary
public booleanequals(java.lang.Object rhs)

 	    boolean equals  = false;
 	    
 	    if ( this == rhs )
 	    {
 	        equals  = true;
 	    }
 	    else if ( ! (rhs instanceof TypeData) )
 	    {
 	        equals  = false;
 	    }
 	    else
 	    {
 	        final TypeData rhsTypeData  = (TypeData)rhs;
 	        
 	        equals  =  ObjectUtil.equals( mJ2EEType, rhsTypeData.mJ2EEType ) &&
 	                    mLegalParentsTypes.equals( rhsTypeData.mLegalParentsTypes ) &&
 	                    ObjectUtil.equals( mContainedByJ2EEType, rhsTypeData.mContainedByJ2EEType );
 	    }
 	    
 	    return equals;
 	
public final java.lang.StringgetContaineeByJ2EEType()

		return( mContainedByJ2EEType );
	
public final java.lang.StringgetJ2EEType()

		return( mJ2EEType );
	
public final java.util.SetgetLegalParentJ2EETypes()

		return( mLegalParentsTypes );
	
public inthashCode()

 	    return ObjectUtil.hashCode(
 	            mJ2EEType, mLegalParentsTypes, mContainedByJ2EEType);
 	
public booleanisSubType()

		return( mLegalParentsTypes != null );