net.sf.jaxme.js
Class JavaSource

java.lang.Object
  extended bynet.sf.jaxme.js.IndentationEngineImpl
      extended bynet.sf.jaxme.js.JavaSource
All Implemented Interfaces:
IndentationEngine
Direct Known Subclasses:
JavaInnerClass

public class JavaSource
extends IndentationEngineImpl

A class representing a Java source file.

Author:
Jochen Wiedmann

Nested Class Summary
static class JavaSource.Protection
           
static class JavaSource.Type
           
 
Field Summary
static JavaSource.Type CLASS
          Type of a JavaSource class.
static JavaSource.Protection DEFAULT_PROTECTION
          Default protection of a class, field or method
static JavaSource.Type INTERFACE
          Type of a JavaSource interface.
static JavaSource.Protection PRIVATE
          Protection of a class, field or method: private
static JavaSource.Protection PROTECTED
          Protection of a class, field or method: protected
static JavaSource.Protection PUBLIC
          Protection of a class, field or method: public
 
Fields inherited from interface net.sf.jaxme.js.IndentationEngine
NOTHING
 
Method Summary
 void addExtends(java.lang.Class pExtends)
          Sets the class or interface extended by this class or interface.
 void addExtends(JavaQName pExtends)
          Sets the class or interface extended by this class or interface.
 void addImplements(java.lang.Class s)
          Adds an interface to the list of interfaces being implemented by this class or interface.
 void addImplements(JavaQName s)
          Adds an interface to the list of interfaces being implemented by this class or interface.
 void addImport(java.lang.Class s)
          Adds a package or class to the list of packages and classes being imported.
 void addImport(JavaQName s)
          Adds a package or class to the list of packages and classes being imported.
 void addInnerClass(JavaInnerClass pClass)
          Adds an inner class.
 void addRawJavaSource(java.lang.String pSource)
          Adds a piece of raw Java source to the class.
 java.lang.String asString(JavaQName pQName, boolean pAddIfPossible)
          Returns whether the given JavaQName is a local class.
 void clearExtends()
          Clears the list of extended classes or interfaces.
 void clearImplements()
          Clears the list of implemented interfaces.
 void clearImports()
          Clears the list of imports.
 void clearInnerClasses()
          Clears the list of inner classes.
 void clearRawJavaSources()
          Clears the list of raw Java sources.
 JavaClassInitializer[] getClassInitializers()
          Returns the static class initializers.
 java.lang.String getClassName()
          Returns the class or interface name.
 JavaComment getComment()
          Returns the comment describing this class or interface.
 java.util.Iterator getConstructorIterator()
          Returns an iterator the the classes constructors.
 JavaConstructor[] getConstructors()
          Returns the list of constructors that this class has.
 JavaQName[] getExtends()
          Returns the class or interface extended by this class or interface.
 JavaSourceFactory getFactory()
          Returns the JavaSourceFactory that created this instance of JavaSource.
 JavaField getField(java.lang.String pName)
          Returns the field with the given name or null, if no such field exists.
 JavaField[] getFields()
          Returns the list of fields that this class has.
 JavaQName[] getImplements()
          Returns the list of interfaces being implented by this class or interface.
 JavaQName[] getImports()
          Returns the list of packages and classes being imported.
 JavaInnerClass[] getInnerClasses()
          Returns the array of inner classes.
 JavaMethod getMethod(java.lang.String pMethodName, JavaQName[] pParams)
          Returns the method with the given signature or null, if there is no such method.
 java.util.Iterator getMethodIterator()
          Returns an iterator to the classes methods.
 JavaMethod[] getMethods()
          Returns the list of methods that this class has.
 java.lang.String getPackageName()
          Returns the package name.
 JavaSource.Protection getProtection()
          Returns the protection.
 JavaQName getQName()
          Returns the JavaSource's JavaQName.
static java.lang.String getQuoted(java.lang.String s)
          Returns a quoted string constant suitable for embedding into Java source.
static java.lang.String getQuotedNoQuotes(java.lang.String s)
          Returns a quoted string constant suitable for embedding into Java source, but without quotes.
 java.lang.String[] getRawJavaSources()
          Returns an array with the pieces of raw Java sources.
protected  boolean getStatic()
          Returns whether this JavaSource is static (for inner classes).
 JavaSource.Type getType()
          Returns the JavaSource type.
 boolean hasDynamicImports()
           
 boolean isAbstract()
          Returns whether class is abstract.
 boolean isExtending(java.lang.Class pClass)
          Returns whether the class is extending the given super class or interface.
 boolean isExtending(JavaQName pClass)
          Returns whether the class is extending the given super class or interface.
 boolean isImplementing(java.lang.Class pClass)
          Returns whether the class is implementing the given interface.
 boolean isImplementing(JavaQName pClass)
          Returns whether the class is implementing the given interface.
 boolean isInnerClass()
          Returns, whether this is an inner class.
 boolean isInterface()
          Returns whether this is an interface or not.
 void newBeanProperty(java.lang.Class pClass, java.lang.String pName)
          Shortcut for newBeanProperty(JavaQNameImpl.getInstance(pClass), pName).
 void newBeanProperty(java.lang.Class pClass, java.lang.String pFieldName, java.lang.String pGetMethodName, java.lang.String pSetMethodName)
          Shortcut for newBeanProperty(JavaQNameImpl.getInstance(pClass), pFieldName, pGetMethodName, pSetMethodName).
 void newBeanProperty(JavaQName pType, java.lang.String pName)
          Creates a new Java property with the given type and name.
 void newBeanProperty(JavaQName pType, java.lang.String pFieldName, java.lang.String pGetMethodName, java.lang.String pSetMethodName)
          Shortcut for newJavaField(pFieldName, pType, JavaSource.PRIVATE); JavaMethod getMethod = newJavaMethod(pGetMethodName, pType, JavaSource.PUBLIC); getMethod.addLine("return this
 JavaComment newComment()
          Creates a new Javadoc comment describing this class or interface.
 JavaClassInitializer newJavaClassInitializer()
          Creates a new instance of JavaClassInitializer
 JavaConstructor newJavaConstructor()
          Creates a new JavaConstructor with default protection
 JavaConstructor newJavaConstructor(JavaConstructor pConstructor)
          Creates a new JavaConstructor with the same parameters, protection and exceptions than the given.
 JavaConstructor newJavaConstructor(JavaConstructor pConstructor, boolean pSuper)
          Creates a new JavaConstructor with the same signature than the given constructors.
 JavaConstructor newJavaConstructor(JavaSource.Protection pProtection)
          Creates a new JavaConstructor with the given protection
 JavaConstructor newJavaConstructor(java.lang.String pProtection)
          Creates a new JavaConstructor with the given protection.
 JavaField newJavaField(java.lang.String pName, java.lang.Class pType)
          Creates a new JavaField with the given name, type and default protection.
 JavaField newJavaField(java.lang.String pName, java.lang.Class pType, JavaSource.Protection pProtection)
          Creates a new JavaField with the given name, type and protection.
 JavaField newJavaField(java.lang.String pName, java.lang.Class pType, java.lang.String pProtection)
          Creates a new JavaField with the given name, type and protection.
 JavaField newJavaField(java.lang.String pName, JavaQName pType)
          Creates a new JavaField with the given name, type and default protection.
 JavaField newJavaField(java.lang.String pName, JavaQName pType, JavaSource.Protection pProtection)
          Creates a new JavaField with the given name, type and protection.
 JavaField newJavaField(java.lang.String pName, JavaQName pType, java.lang.String pProtection)
          Creates a new JavaField with the given name, type and protection.
 JavaField newJavaField(java.lang.String pName, java.lang.String pType)
          Creates a new JavaField with the given name, type and default protection.
 JavaField newJavaField(java.lang.String pName, java.lang.String pType, JavaSource.Protection pProtection)
          Creates a new JavaField with the given name, type and protection.
 JavaField newJavaField(java.lang.String pName, java.lang.String pType, java.lang.String pProtection)
          Creates a new JavaField with the given name, type and protection.
 JavaInnerClass newJavaInnerClass(java.lang.String pName)
          Creates a new JavaInnerClass with the given name and default protection.
 JavaInnerClass newJavaInnerClass(java.lang.String pName, JavaSource.Protection pProtection)
          Creates a new JavaInnerClass with the given name and protection.
 JavaInnerClass newJavaInnerClass(java.lang.String pName, java.lang.String pProtection)
          Creates a new JavaInnerClass with the given name and protection.
 JavaMethod newJavaMethod(JavaMethod pMethod)
          Creates a new JavaMethod with the given methods name and signature.
 JavaMethod newJavaMethod(java.lang.reflect.Method pMethod)
          Creates a new JavaMethod with the signature of the given method pMethod.
 JavaMethod newJavaMethod(java.lang.String pName, java.lang.Class pType)
          Creates a new JavaMethod with the given name, return type and default protection.
 JavaMethod newJavaMethod(java.lang.String pName, java.lang.Class pType, JavaSource.Protection pProtection)
          Creates a new JavaMethod with the given name, return type and protection.
 JavaMethod newJavaMethod(java.lang.String pName, java.lang.Class pType, java.lang.String pProtection)
          Creates a new JavaMethod with the given name, return type and protection.
 JavaMethod newJavaMethod(java.lang.String pName, JavaQName pType)
          Creates a new JavaMethod with the given name, return type and default protection.
 JavaMethod newJavaMethod(java.lang.String pName, JavaQName pType, JavaSource.Protection pProtection)
          Creates a new JavaMethod with the given name, return type and protection.
 JavaMethod newJavaMethod(java.lang.String pName, JavaQName pType, java.lang.String pProtection)
          Creates a new JavaMethod with the given name, return type and protection.
 JavaMethod newJavaMethod(java.lang.String pName, java.lang.String pType)
          Creates a new JavaMethod with the given name, return type and default protection.
 JavaMethod newJavaMethod(java.lang.String pName, java.lang.String pType, JavaSource.Protection pProtection)
          Creates a new JavaMethod with the given name, return type and protection.
 JavaMethod newJavaMethod(java.lang.String pName, java.lang.String pType, java.lang.String pProtection)
          Creates a new JavaMethod with the given name, return type and protection.
 void setAbstract(boolean isAbstract)
          Sets whether this class is abstract,
 void setDynamicImports(boolean pDynamicImports)
           
 void setProtection(JavaSource.Protection protection)
          Sets the protection; use null for default protection.
 void setQName(JavaQName pQName)
          Sets the JavaSource's JavaQName.
 void setStatic(boolean pStatic)
          Sets whether this JavaSource is static (for inner classes).
 void setType(JavaSource.Type pType)
          Sets the JavaSource type.
 java.lang.String toString()
          Returns a string representation of this JavaSource file.
 void write(IndentationTarget pTarget)
          Adds the IndentationEngine's contents to the given IndentationTarget.
 void write(java.io.Writer pTarget)
          Writes the JavaSource contents into the given Writer.
 
Methods inherited from class net.sf.jaxme.js.IndentationEngineImpl
addLine, addLine, addLine, addLine, addLine, addLine, addLine, addLine, addLine, addLine, addLine, addLine, addLine, addLine, addLine, addLine, addLine, addLine, asString, checkNulls, clear, getLevel, getLines, getLines, getPlaceHolder, indent, isEmpty, moveToBottom, moveToTop, newPlaceHolder, removePlaceHolder, setLevel, unindent, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS

public static final JavaSource.Type CLASS

Type of a JavaSource class.

See Also:
INTERFACE, getType(), setType(net.sf.jaxme.js.JavaSource.Type)

INTERFACE

public static final JavaSource.Type INTERFACE

Type of a JavaSource interface.

See Also:
CLASS, getType(), setType(net.sf.jaxme.js.JavaSource.Type)

PUBLIC

public static final JavaSource.Protection PUBLIC

Protection of a class, field or method: public


PROTECTED

public static final JavaSource.Protection PROTECTED

Protection of a class, field or method: protected


PRIVATE

public static final JavaSource.Protection PRIVATE

Protection of a class, field or method: private


DEFAULT_PROTECTION

public static final JavaSource.Protection DEFAULT_PROTECTION

Default protection of a class, field or method

Method Detail

getClassInitializers

public JavaClassInitializer[] getClassInitializers()

Returns the static class initializers.


getFactory

public JavaSourceFactory getFactory()

Returns the JavaSourceFactory that created this instance of JavaSource.


getQName

public JavaQName getQName()

Returns the JavaSource's JavaQName.


setQName

public void setQName(JavaQName pQName)

Sets the JavaSource's JavaQName.


getClassName

public java.lang.String getClassName()

Returns the class or interface name.

See Also:
setQName(net.sf.jaxme.js.JavaQName)

getPackageName

public java.lang.String getPackageName()

Returns the package name. The empty String represents the default package.


getProtection

public JavaSource.Protection getProtection()

Returns the protection.

See Also:
setProtection(net.sf.jaxme.js.JavaSource.Protection)

setProtection

public void setProtection(JavaSource.Protection protection)

Sets the protection; use null for default protection.

See Also:
getProtection()

getType

public JavaSource.Type getType()

Returns the JavaSource type.

Returns:
"class" or "interface"
See Also:
setType(net.sf.jaxme.js.JavaSource.Type)

setType

public void setType(JavaSource.Type pType)

Sets the JavaSource type.

Parameters:
pType - "class" or "interface"
See Also:
getType()

getComment

public JavaComment getComment()

Returns the comment describing this class or interface.

See Also:
newComment()

newComment

public JavaComment newComment()

Creates a new Javadoc comment describing this class or interface.

See Also:
getComment()

clearExtends

public void clearExtends()

Clears the list of extended classes or interfaces.


getExtends

public JavaQName[] getExtends()

Returns the class or interface extended by this class or interface.

See Also:
addExtends(JavaQName)

addExtends

public void addExtends(JavaQName pExtends)

Sets the class or interface extended by this class or interface. Null or the empty string disable the "extends" clause.

See Also:
getExtends()

addExtends

public void addExtends(java.lang.Class pExtends)

Sets the class or interface extended by this class or interface. Null or the empty string disable the "extends" clause.

See Also:
getExtends()

isExtending

public boolean isExtending(JavaQName pClass)

Returns whether the class is extending the given super class or interface.


isExtending

public boolean isExtending(java.lang.Class pClass)

Returns whether the class is extending the given super class or interface.


getImports

public JavaQName[] getImports()

Returns the list of packages and classes being imported.

See Also:
addImport(net.sf.jaxme.js.JavaQName)

addImport

public void addImport(JavaQName s)

Adds a package or class to the list of packages and classes being imported.

See Also:
addImport(net.sf.jaxme.js.JavaQName)

addImport

public void addImport(java.lang.Class s)

Adds a package or class to the list of packages and classes being imported.

See Also:
addImport(net.sf.jaxme.js.JavaQName)

clearImports

public void clearImports()

Clears the list of imports.


getImplements

public JavaQName[] getImplements()

Returns the list of interfaces being implented by this class or interface.

See Also:
addImplements(net.sf.jaxme.js.JavaQName)

addImplements

public void addImplements(JavaQName s)

Adds an interface to the list of interfaces being implemented by this class or interface.

See Also:
getImplements()

addImplements

public void addImplements(java.lang.Class s)

Adds an interface to the list of interfaces being implemented by this class or interface.

See Also:
getImplements()

clearImplements

public void clearImplements()

Clears the list of implemented interfaces.


isImplementing

public boolean isImplementing(JavaQName pClass)

Returns whether the class is implementing the given interface.


isImplementing

public boolean isImplementing(java.lang.Class pClass)

Returns whether the class is implementing the given interface.


getField

public JavaField getField(java.lang.String pName)

Returns the field with the given name or null, if no such field exists.


getFields

public JavaField[] getFields()

Returns the list of fields that this class has.

See Also:
newJavaField(java.lang.String, net.sf.jaxme.js.JavaQName, net.sf.jaxme.js.JavaSource.Protection)

getConstructors

public JavaConstructor[] getConstructors()

Returns the list of constructors that this class has.

See Also:
newJavaConstructor()

getConstructorIterator

public java.util.Iterator getConstructorIterator()

Returns an iterator the the classes constructors. This iterator allows to remove constructors.


getMethods

public JavaMethod[] getMethods()

Returns the list of methods that this class has.

See Also:
newJavaMethod(java.lang.String, java.lang.String)

getMethod

public JavaMethod getMethod(java.lang.String pMethodName,
                            JavaQName[] pParams)

Returns the method with the given signature or null, if there is no such method.


getMethodIterator

public java.util.Iterator getMethodIterator()

Returns an iterator to the classes methods. This iterator allows to remove certain methods.


write

public void write(IndentationTarget pTarget)
           throws java.io.IOException
Description copied from interface: IndentationEngine

Adds the IndentationEngine's contents to the given IndentationTarget.

Specified by:
write in interface IndentationEngine
Overrides:
write in class IndentationEngineImpl
Throws:
java.io.IOException

getQuotedNoQuotes

public static java.lang.String getQuotedNoQuotes(java.lang.String s)

Returns a quoted string constant suitable for embedding into Java source, but without quotes.


getQuoted

public static java.lang.String getQuoted(java.lang.String s)

Returns a quoted string constant suitable for embedding into Java source.


addInnerClass

public void addInnerClass(JavaInnerClass pClass)

Adds an inner class.


clearInnerClasses

public void clearInnerClasses()

Clears the list of inner classes.


getInnerClasses

public JavaInnerClass[] getInnerClasses()

Returns the array of inner classes.


getStatic

protected boolean getStatic()

Returns whether this JavaSource is static (for inner classes).


setStatic

public void setStatic(boolean pStatic)

Sets whether this JavaSource is static (for inner classes).


addRawJavaSource

public void addRawJavaSource(java.lang.String pSource)

Adds a piece of raw Java source to the class.


clearRawJavaSources

public void clearRawJavaSources()

Clears the list of raw Java sources.


getRawJavaSources

public java.lang.String[] getRawJavaSources()

Returns an array with the pieces of raw Java sources.


isAbstract

public boolean isAbstract()

Returns whether class is abstract.


setAbstract

public void setAbstract(boolean isAbstract)

Sets whether this class is abstract,


isInterface

public boolean isInterface()

Returns whether this is an interface or not.


asString

public java.lang.String asString(JavaQName pQName,
                                 boolean pAddIfPossible)

Returns whether the given JavaQName is a local class. In other words, whether the package name can be omitted when referencing the class.


hasDynamicImports

public boolean hasDynamicImports()

setDynamicImports

public void setDynamicImports(boolean pDynamicImports)

write

public void write(java.io.Writer pTarget)
           throws java.io.IOException

Writes the JavaSource contents into the given Writer.

Throws:
java.io.IOException

toString

public java.lang.String toString()

Returns a string representation of this JavaSource file.


newJavaClassInitializer

public JavaClassInitializer newJavaClassInitializer()
Creates a new instance of JavaClassInitializer


newJavaConstructor

public JavaConstructor newJavaConstructor()
Creates a new JavaConstructor with default protection


newJavaConstructor

public JavaConstructor newJavaConstructor(JavaSource.Protection pProtection)
Creates a new JavaConstructor with the given protection


newJavaConstructor

public JavaConstructor newJavaConstructor(java.lang.String pProtection)

Creates a new JavaConstructor with the given protection. Equivalent to newJavaConstructor(Protection.valueOf(pProtection)).


newJavaConstructor

public JavaConstructor newJavaConstructor(JavaConstructor pConstructor)

Creates a new JavaConstructor with the same parameters, protection and exceptions than the given. Equivalent to newJavaConstructor(pConstructor, false).


newJavaConstructor

public JavaConstructor newJavaConstructor(JavaConstructor pConstructor,
                                          boolean pSuper)

Creates a new JavaConstructor with the same signature than the given constructors. Equivalent to newJavaConstructor(pConstructor, false). If the pSuper argument is true, adds an invocation of the super classes constructor with the same arguments.


newJavaMethod

public JavaMethod newJavaMethod(java.lang.String pName,
                                java.lang.String pType)

Creates a new JavaMethod with the given name, return type and default protection.


newJavaMethod

public JavaMethod newJavaMethod(java.lang.String pName,
                                java.lang.String pType,
                                JavaSource.Protection pProtection)

Creates a new JavaMethod with the given name, return type and protection.


newJavaMethod

public JavaMethod newJavaMethod(java.lang.String pName,
                                java.lang.String pType,
                                java.lang.String pProtection)

Creates a new JavaMethod with the given name, return type and protection.


newJavaMethod

public JavaMethod newJavaMethod(java.lang.String pName,
                                JavaQName pType)

Creates a new JavaMethod with the given name, return type and default protection.


newJavaMethod

public JavaMethod newJavaMethod(java.lang.String pName,
                                JavaQName pType,
                                JavaSource.Protection pProtection)

Creates a new JavaMethod with the given name, return type and protection.


newJavaMethod

public JavaMethod newJavaMethod(java.lang.String pName,
                                JavaQName pType,
                                java.lang.String pProtection)

Creates a new JavaMethod with the given name, return type and protection.


newJavaMethod

public JavaMethod newJavaMethod(java.lang.String pName,
                                java.lang.Class pType)

Creates a new JavaMethod with the given name, return type and default protection.


newJavaMethod

public JavaMethod newJavaMethod(java.lang.String pName,
                                java.lang.Class pType,
                                JavaSource.Protection pProtection)

Creates a new JavaMethod with the given name, return type and protection.


newJavaMethod

public JavaMethod newJavaMethod(java.lang.String pName,
                                java.lang.Class pType,
                                java.lang.String pProtection)

Creates a new JavaMethod with the given name, return type and protection.


newJavaMethod

public JavaMethod newJavaMethod(java.lang.reflect.Method pMethod)

Creates a new JavaMethod with the signature of the given method pMethod. More precise:

  1. The name of the created method is pMethod.getName().
  2. The return type is set to pMethod.getReturnType().
  3. The protection is set to pMethod.
  4. For any class in pMethod.getParameterTypes(), calls AbstractJavaMethod.addParam(Class,String) with the parameter names "p0", "p1", ...
  5. For any exception in pMethod.getExceptionTypes(), calls AbstractJavaMethod.addThrows(Class).


newJavaMethod

public JavaMethod newJavaMethod(JavaMethod pMethod)

Creates a new JavaMethod with the given methods name and signature. This is useful, for example, if you have an interface and derive an implementation. The following values are not cloned: JavaSourceObject.isAbstract(), JavaSourceObject.isStatic(), JavaSourceObject.isFinal(), and JavaMethod.isSynchronized().


newJavaField

public JavaField newJavaField(java.lang.String pName,
                              JavaQName pType,
                              JavaSource.Protection pProtection)

Creates a new JavaField with the given name, type and protection.


newJavaField

public JavaField newJavaField(java.lang.String pName,
                              JavaQName pType,
                              java.lang.String pProtection)

Creates a new JavaField with the given name, type and protection.


newJavaField

public JavaField newJavaField(java.lang.String pName,
                              JavaQName pType)

Creates a new JavaField with the given name, type and default protection.


newJavaField

public JavaField newJavaField(java.lang.String pName,
                              java.lang.String pType,
                              JavaSource.Protection pProtection)

Creates a new JavaField with the given name, type and protection.


newJavaField

public JavaField newJavaField(java.lang.String pName,
                              java.lang.String pType,
                              java.lang.String pProtection)

Creates a new JavaField with the given name, type and protection.


newJavaField

public JavaField newJavaField(java.lang.String pName,
                              java.lang.String pType)

Creates a new JavaField with the given name, type and default protection.


newJavaField

public JavaField newJavaField(java.lang.String pName,
                              java.lang.Class pType,
                              JavaSource.Protection pProtection)

Creates a new JavaField with the given name, type and protection.


newJavaField

public JavaField newJavaField(java.lang.String pName,
                              java.lang.Class pType,
                              java.lang.String pProtection)

Creates a new JavaField with the given name, type and protection. Equivalent to newJavaField(pName, pType, Protection.valueOf(pProtecttion).


newJavaField

public JavaField newJavaField(java.lang.String pName,
                              java.lang.Class pType)

Creates a new JavaField with the given name, type and default protection.


newJavaInnerClass

public JavaInnerClass newJavaInnerClass(java.lang.String pName)

Creates a new JavaInnerClass with the given name and default protection.


newJavaInnerClass

public JavaInnerClass newJavaInnerClass(java.lang.String pName,
                                        JavaSource.Protection pProtection)

Creates a new JavaInnerClass with the given name and protection.


newJavaInnerClass

public JavaInnerClass newJavaInnerClass(java.lang.String pName,
                                        java.lang.String pProtection)

Creates a new JavaInnerClass with the given name and protection.


isInnerClass

public boolean isInnerClass()

Returns, whether this is an inner class.


newBeanProperty

public void newBeanProperty(JavaQName pType,
                            java.lang.String pName)

Creates a new Java property with the given type and name. Shortcut for

 String upperCaseName = Character.toUpperCase(pName.charAt(0)) +
     pName.substring(1);
 if (JavaQNameImpl.VOID.equals(pType)) {
   newBeanProperty(pType, pName, "is" + upperCaseName, "set" + upperCaseName);
 } else {
   newBeanProperty(pType, pName, "get" + upperCaseName, "set" + upperCaseName);
 }
 


newBeanProperty

public void newBeanProperty(java.lang.Class pClass,
                            java.lang.String pName)

Shortcut for newBeanProperty(JavaQNameImpl.getInstance(pClass), pName).

See Also:
newBeanProperty(JavaQName, String)

newBeanProperty

public void newBeanProperty(JavaQName pType,
                            java.lang.String pFieldName,
                            java.lang.String pGetMethodName,
                            java.lang.String pSetMethodName)

Shortcut for

 newJavaField(pFieldName, pType, JavaSource.PRIVATE);
 JavaMethod getMethod = newJavaMethod(pGetMethodName, pType, JavaSource.PUBLIC);
 getMethod.addLine("return this.", pFieldName, ";");
 JavaMethod setMethod = newJavaMethod(pSetMethodName, JavaQNameImpl.VOID, JavaSource.PUBLIC);
 setMethod.addParam(pType, pFieldName);
 setMethod.addLine("this.", pFieldName, " = ", pFieldName, ";");
 

Parameters:
pType - The property type
pFieldName - The name of the generated field. The generated field has private access.
pGetMethodName - The name of the generated get method or null, if no such method is being created.
pSetMethodName - The name of the generated set method or null, if no such method is being created.

newBeanProperty

public void newBeanProperty(java.lang.Class pClass,
                            java.lang.String pFieldName,
                            java.lang.String pGetMethodName,
                            java.lang.String pSetMethodName)

Shortcut for newBeanProperty(JavaQNameImpl.getInstance(pClass), pFieldName, pGetMethodName, pSetMethodName).

See Also:
newBeanProperty(JavaQName, String, String, String)