org.apache.jdo.impl.model.java
Class AbstractJavaMember

java.lang.Object
  extended by org.apache.jdo.impl.model.java.AbstractJavaMember
All Implemented Interfaces:
JavaElement, JavaMember
Direct Known Subclasses:
BaseReflectionJavaField, JavaPropertyImpl, ReflectionJavaMethod

public abstract class AbstractJavaMember
extends java.lang.Object
implements JavaMember

Abstract super class for JavaMember implementations. It provides getters for the name and declaringClass properties which are initialized in the constructor.

A non-abstract subclass must implement methods getModifiers() and getType().

Since:
JDO 2.0
Author:
Michael Bouschen

Constructor Summary
AbstractJavaMember(java.lang.String name, JavaType declaringClass)
          Constructor setting the name and declaringClass property.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 JavaType getComponentType()
          Returns the JavaType representation of the component type of the type of the property, if the property type is an array or collection.
 JavaType getDeclaringClass()
          Returns the JavaType instance representing the class or interface that declares the field represented by this JavaMember instance.
abstract  int getModifiers()
          Returns the Java language modifiers for the member represented by this JavaMember, as an integer.
 java.lang.String getName()
          Returns the name of the field.
abstract  JavaType getType()
          Returns the JavaType representation of the type of the memeber.
 int hashCode()
          Returns a hash code value for the object.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.jdo.model.java.JavaElement
getUnderlyingObject
 

Constructor Detail

AbstractJavaMember

public AbstractJavaMember(java.lang.String name,
                          JavaType declaringClass)
Constructor setting the name and declaringClass property.

Parameters:
name - field name
declaringClass - the JavaType of the class or interface that declares this JavaMember.
Method Detail

getName

public java.lang.String getName()
Returns the name of the field.

Specified by:
getName in interface JavaMember
Returns:
field name

getDeclaringClass

public JavaType getDeclaringClass()
Returns the JavaType instance representing the class or interface that declares the field represented by this JavaMember instance.

Specified by:
getDeclaringClass in interface JavaMember
Returns:
the JavaType instance of the declaring class.

getModifiers

public abstract int getModifiers()
Returns the Java language modifiers for the member represented by this JavaMember, as an integer. The java.lang.reflect.Modifier class should be used to decode the modifiers.

Specified by:
getModifiers in interface JavaMember
Returns:
the Java language modifiers for this JavaMember
See Also:
Modifier

getType

public abstract JavaType getType()
Returns the JavaType representation of the type of the memeber.

Specified by:
getType in interface JavaMember
Returns:
type of the member

getComponentType

public JavaType getComponentType()
Returns the JavaType representation of the component type of the type of the property, if the property type is an array or collection. The method returns null, if the property type is not an array or collection.

Specified by:
getComponentType in interface JavaMember
Returns:
the component type of the property type in case of an array or collection.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the reference object with which to compare.

This implementation matches the declaring class and the name of the specified object to the declaring class and the name of this JavaMember.

Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for the object.

This is computed as the exclusive-or of the hashcodes for the underlying field's declaring class name and its name.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this object.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.