Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.progeeks.meta
Class MetaClass  view MetaClass download MetaClass.java

java.lang.Object
  extended byorg.progeeks.meta.MetaClass

public class MetaClass
extends java.lang.Object

Describes the properties associated with a meta-object. MetaClass objects must be created through the factory methods provided by the MetaClassRegistry to which they will belong.

Version:
$Revision: 1.11 $

Field Summary
private  MetaClassRegistry classRegistry
           
private  java.lang.String name
           
private  java.util.Map properties
           
private  boolean resolved
           
private  java.util.List superclasses
           
 
Constructor Summary
protected MetaClass(MetaClassRegistry classRegistry, java.lang.String name, java.util.Collection propertyInfo)
          Creates the meta-class using the specified parameters.
protected MetaClass(MetaClassRegistry classRegistry, java.lang.String name, java.util.Collection propertyInfo, java.util.Collection superclasses)
          Creates the meta-class using the specified parameters.
protected MetaClass(MetaClassRegistry classRegistry, java.lang.String name, java.util.Collection propertyInfo, MetaClass superclass)
          Creates the meta-class using the specified parameters.
 
Method Summary
protected  void addProperty(PropertyInfo info)
          Adds the specified property info to this meta-class.
 boolean equals(MetaClass mClass)
           
 boolean equals(java.lang.Object obj)
          Determine whether this Object is semantically equal to another Object.
 MetaClassRegistry getClassRegistry()
          Returns the class registry to which this meta-class belongs.
 java.lang.String getName()
          Returns the name of this meta-class.
 PropertyInfo getPropertyInfo(java.lang.String name)
          Returns the descriptive information for the specified property.
 java.util.Collection getPropertyInfos()
          Returns an unmodifiable collection of property info objects.
 java.util.Set getPropertyNames()
          Returns the unmodifiable set of property names.
 PropertyType getPropertyType(java.lang.String name)
          Returns the type for the specified property.
 java.util.List getSuperclasses()
          Returns a List containing the immediate superclasses of this meta-class.
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
 boolean isInstance(MetaObject obj)
          Returns true if the specified meta-object is an instance of this class.
 java.util.Iterator propertyNames()
          Returns an iterator over all valid property names.
protected  PropertyType resolveType(PropertyType type)
          Called internally to resolve a property type if it is required.
 void resolveTypes()
          Resolves any deferred types against the class registry associated with this meta-class.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

classRegistry

private MetaClassRegistry classRegistry

name

private java.lang.String name

properties

private java.util.Map properties

superclasses

private java.util.List superclasses

resolved

private boolean resolved
Constructor Detail

MetaClass

protected MetaClass(MetaClassRegistry classRegistry,
                    java.lang.String name,
                    java.util.Collection propertyInfo)
Creates the meta-class using the specified parameters.


MetaClass

protected MetaClass(MetaClassRegistry classRegistry,
                    java.lang.String name,
                    java.util.Collection propertyInfo,
                    java.util.Collection superclasses)
Creates the meta-class using the specified parameters.


MetaClass

protected MetaClass(MetaClassRegistry classRegistry,
                    java.lang.String name,
                    java.util.Collection propertyInfo,
                    MetaClass superclass)
Creates the meta-class using the specified parameters.

Method Detail

resolveType

protected PropertyType resolveType(PropertyType type)
Called internally to resolve a property type if it is required.


resolveTypes

public void resolveTypes()
Resolves any deferred types against the class registry associated with this meta-class. This should be called by meta-object implementations during instantiation until a more automatic way becomes available.


getClassRegistry

public MetaClassRegistry getClassRegistry()
Returns the class registry to which this meta-class belongs.


getName

public java.lang.String getName()
Returns the name of this meta-class.


getSuperclasses

public java.util.List getSuperclasses()
Returns a List containing the immediate superclasses of this meta-class.


addProperty

protected void addProperty(PropertyInfo info)
Adds the specified property info to this meta-class.


getPropertyType

public PropertyType getPropertyType(java.lang.String name)
Returns the type for the specified property.


getPropertyInfo

public PropertyInfo getPropertyInfo(java.lang.String name)
Returns the descriptive information for the specified property.


propertyNames

public java.util.Iterator propertyNames()
Returns an iterator over all valid property names.


getPropertyNames

public java.util.Set getPropertyNames()
Returns the unmodifiable set of property names.


getPropertyInfos

public java.util.Collection getPropertyInfos()
Returns an unmodifiable collection of property info objects.


isInstance

public boolean isInstance(MetaObject obj)
Returns true if the specified meta-object is an instance of this class.


hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)


equals

public boolean equals(MetaClass mClass)

equals

public boolean equals(java.lang.Object obj)
Description copied from class: java.lang.Object
Determine whether this Object is semantically equal to another Object.

There are some fairly strict requirements on this method which subclasses must follow:

  • It must be transitive. If a.equals(b) and b.equals(c), then a.equals(c) must be true as well.
  • It must be symmetric. a.equals(b) and b.equals(a) must have the same value.
  • It must be reflexive. a.equals(a) must always be true.
  • It must be consistent. Whichever value a.equals(b) returns on the first invocation must be the value returned on all later invocations.
  • a.equals(null) must be false.
  • It must be consistent with hashCode(). That is, a.equals(b) must imply a.hashCode() == b.hashCode(). The reverse is not true; two objects that are not equal may have the same hashcode, but that has the potential to harm hashing performance.

This is typically overridden to throw a java.lang.ClassCastException if the argument is not comparable to the class performing the comparison, but that is not a requirement. It is legal for a.equals(b) to be true even though a.getClass() != b.getClass(). Also, it is typical to never cause a java.lang.NullPointerException.

In general, the Collections API (java.util) use the equals method rather than the == operator to compare objects. However, java.util.IdentityHashMap is an exception to this rule, for its own good reasons.

The default implementation returns this == o.


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).