org.springframework.config.java.model
Class ModelClass

java.lang.Object
  extended by org.springframework.config.java.model.ModelClass
All Implemented Interfaces:
org.springframework.beans.BeanMetadataElement

public class ModelClass
extends java.lang.Object
implements org.springframework.beans.BeanMetadataElement

Abstract representation of a class, free from java reflection. Base class used within the internal JavaConfig metamodel for representing Configuration classes.

Author:
Chris Beams

Constructor Summary
ModelClass()
          Creates a new and empty ModelClass instance.
ModelClass(java.lang.String name)
          Creates a new ModelClass instance
ModelClass(java.lang.String name, boolean isInterface)
          Creates a new ModelClass instance
 
Method Summary
 boolean equals(java.lang.Object obj)
           
static ModelClass forClass(java.lang.Class<?> clazz)
          Creates a new ModelClass for a given Class.
 java.lang.String getName()
          Returns the fully-qualified name of this class.
 java.lang.String getSimpleName()
          Returns the non-qualified name of this class.
 java.lang.String getSource()
          Returns a resource path-formatted representation of the .java file that declares this class
 int hashCode()
           
 boolean isInterface()
          Returns whether the class represented by this ModelClass instance is an interface.
 void setInterface(boolean isInterface)
          Signifies that this class is (true) or is not (false) an interface.
 void setName(java.lang.String className)
          Sets the fully-qualified name of this class.
 void setSource(java.lang.Object source)
          Set the source location for this class.
 java.lang.String toString()
          Given a ModelClass instance representing a class com.acme.Foo, this method will return
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModelClass

public ModelClass()
Creates a new and empty ModelClass instance.


ModelClass

public ModelClass(java.lang.String name)
Creates a new ModelClass instance

Parameters:
name - fully-qualified name of the class being represented

ModelClass

public ModelClass(java.lang.String name,
                  boolean isInterface)
Creates a new ModelClass instance

Parameters:
name - fully-qualified name of the class being represented
isInterface - whether the represented type is an interface
Method Detail

getName

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


setName

public void setName(java.lang.String className)
Sets the fully-qualified name of this class.


getSimpleName

public java.lang.String getSimpleName()
Returns the non-qualified name of this class. Given com.acme.Foo, returns 'Foo'.


isInterface

public boolean isInterface()
Returns whether the class represented by this ModelClass instance is an interface.


setInterface

public void setInterface(boolean isInterface)
Signifies that this class is (true) or is not (false) an interface.


getSource

public java.lang.String getSource()
Returns a resource path-formatted representation of the .java file that declares this class

Specified by:
getSource in interface org.springframework.beans.BeanMetadataElement

setSource

public void setSource(java.lang.Object source)
Set the source location for this class. Must be a resource-path formatted string.

Parameters:
source - resource path to the .java file that declares this class.

forClass

public static ModelClass forClass(java.lang.Class<?> clazz)
Creates a new ModelClass for a given Class. A very limited subset of data is populated for the class.


toString

public java.lang.String toString()
Given a ModelClass instance representing a class com.acme.Foo, this method will return
 ModelClass: name=Foo
 

Overrides:
toString in class java.lang.Object

hashCode

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

equals

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