org.apache.ws.jaxme.js
public class JavaSource extends IndentationEngineImpl
Nested Class Summary | |
---|---|
static class | JavaSource.Protection Specifies a java objects protection (default, public,
protected, or private). |
static class | JavaSource.Type Specifies the type of a java class (interface, or class). |
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 |
Method Summary | |
---|---|
void | addExtends(JavaQName pExtends) Sets the class or interface extended by this class or interface.
|
void | addExtends(Class pExtends) Sets the class or interface extended 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 | addImplements(Class s) Adds an interface to the list of interfaces being implemented by
this class or interface. |
void | addImport(JavaQName s) Adds a package or class to the list of packages and classes being imported. |
void | addImport(Class 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(String pSource) Adds a piece of raw Java source to the class. |
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. |
String | getClassName() Returns the class or interface name. |
JavaComment | getComment() Returns the comment describing this class or interface. |
JavaConstructor | getConstructor(JavaQName[] pParams) Returns the constructor with the given signature or null, if there
is no such constructor. |
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(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 | getInnerClass(String pName) Returns the inner class named pName , or
null, if no such class exists. |
JavaInnerClass[] | getInnerClasses() Returns the array of inner classes. |
JavaMethod | getMethod(String pMethodName, JavaQName[] pParams) Returns the method with the given signature or null, if there
is no such method. |
Iterator | getMethodIterator() Returns an iterator to the classes methods. |
JavaMethod[] | getMethods() Returns the list of methods that this class has. |
String | getPackageName() Returns the package name. |
JavaSource.Protection | getProtection() Returns the protection. |
JavaQName | getQName() Returns the JavaSource's JavaQName. |
static String | getQuoted(String s) Returns a quoted string constant suitable for embedding
into Java source. |
static String | getQuotedNoQuotes(String s) Returns a quoted string constant suitable for embedding
into Java source, but without quotes. |
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() Returns, whether the class is automatically adding imports. |
boolean | isAbstract() Returns whether class is abstract. |
boolean | isExtending(JavaQName pClass) Returns whether the class is extending the given super class or interface. |
boolean | isExtending(Class pClass) Returns whether the class is extending the given super class or interface. |
boolean | isForcingFullyQualifiedName() Returns, whether class references are always using the
fully qualified class name. |
boolean | isImplementing(JavaQName pClass) Returns whether the class is implementing the given interface. |
boolean | isImplementing(Class 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(JavaQName pType, String pName) Creates a new Java property with the given type and name.
|
void | newBeanProperty(Class pClass, String pName) Shortcut for newBeanProperty(JavaQNameImpl.getInstance(pClass), pName) . |
void | newBeanProperty(JavaQName pType, String pFieldName, String pGetMethodName, 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, ";"); |
void | newBeanProperty(Class pClass, String pFieldName, String pGetMethodName, String pSetMethodName) Shortcut for newBeanProperty(JavaQNameImpl.getInstance(pClass),
pFieldName, pGetMethodName, pSetMethodName) . |
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(JavaSource.Protection pProtection) Creates a new JavaConstructor with the given protection. |
JavaConstructor | newJavaConstructor(String pProtection) Creates a new JavaConstructor with the given 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(Constructor pConstructor) Creates a new JavaConstructor with the signature of the
given constructor. |
JavaField | newJavaField(Field pField) Creates a new JavaField with the given fields signature. |
JavaField | newJavaField(String pName, JavaQName pType, JavaSource.Protection pProtection) Creates a new JavaField with the given name, type and
protection. |
JavaField | newJavaField(String pName, JavaQName pType, String pProtection) Creates a new JavaField with the given name, type and
protection. |
JavaField | newJavaField(String pName, JavaQName pType) Creates a new JavaField with the given name, type and
default protection. |
JavaField | newJavaField(String pName, String pType, JavaSource.Protection pProtection) Creates a new JavaField with the given name, type and
protection. |
JavaField | newJavaField(String pName, String pType, String pProtection) Creates a new JavaField with the given name, type and
protection. |
JavaField | newJavaField(String pName, String pType) Creates a new JavaField with the given name, type and
default protection. |
JavaField | newJavaField(String pName, Class pType, JavaSource.Protection pProtection) Creates a new JavaField with the given name, type and
protection. |
JavaField | newJavaField(String pName, Class pType, String pProtection) Creates a new JavaField with the given name, type and
protection. |
JavaField | newJavaField(String pName, Class pType) Creates a new JavaField with the given name, type and
default protection. |
JavaInnerClass | newJavaInnerClass(String pName) Creates a new JavaInnerClass with the given name and
default protection. |
JavaInnerClass | newJavaInnerClass(String pName, JavaSource.Protection pProtection) Creates a new JavaInnerClass with the given name and
protection. |
JavaInnerClass | newJavaInnerClass(String pName, String pProtection) Creates a new JavaInnerClass with the given name and
protection. |
JavaMethod | newJavaMethod(String pName, String pType) Creates a new JavaMethod with the given name, return
type and default protection. |
JavaMethod | newJavaMethod(String pName, String pType, JavaSource.Protection pProtection) Creates a new JavaMethod with the given name, return
type and protection. |
JavaMethod | newJavaMethod(String pName, String pType, String pProtection) Creates a new JavaMethod with the given name, return
type and protection. |
JavaMethod | newJavaMethod(String pName, JavaQName pType) Creates a new JavaMethod with the given name, return
type and default protection. |
JavaMethod | newJavaMethod(String pName, JavaQName pType, JavaSource.Protection pProtection) Creates a new JavaMethod with the given name, return
type and protection. |
JavaMethod | newJavaMethod(String pName, JavaQName pType, String pProtection) Creates a new JavaMethod with the given name, return
type and protection. |
JavaMethod | newJavaMethod(String pName, Class pType) Creates a new JavaMethod with the given name, return
type and default protection. |
JavaMethod | newJavaMethod(String pName, Class pType, JavaSource.Protection pProtection) Creates a new JavaMethod with the given name, return
type and protection. |
JavaMethod | newJavaMethod(String pName, Class pType, String pProtection) Creates a new JavaMethod with the given name, return
type and protection. |
JavaMethod | newJavaMethod(Method pMethod) Creates a new JavaMethod with the signature of the given method
pMethod .
|
JavaMethod | newJavaMethod(JavaMethod pMethod) Creates a new JavaMethod with the given methods name and signature.
|
void | setAbstract(boolean isAbstract) Sets whether this class is abstract. |
void | setDynamicImports(boolean pDynamicImports) Sets, whether the class is automatically adding imports. |
void | setForcingFullyQualifiedName(boolean pForcingFullyQualifiedName) Sets, whether class references are always using the
fully qualified class name. |
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. |
String | toString() Returns a string representation of this JavaSource file. |
void | write(IndentationTarget pTarget) |
void | write(Writer pTarget) Writes the JavaSource contents into the given Writer. |
See Also: INTERFACE JavaSource JavaSource
See Also: CLASS JavaSource JavaSource
See Also: JavaSource
See Also: JavaSource
See Also: getImplements
See Also: getImplements
See Also: getImports
See Also: addImport
See Also: JavaSource
See Also: JavaSource
See Also: JavaSource
See Also: addExtends
See Also: JavaSource
See Also: addImplements
See Also: addImport
pName
, or
null, if no such class exists.See Also: JavaSource
See Also: JavaSource
Returns: "class" or "interface"
See Also: JavaSource
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(JavaQNameImpl.getInstance(pClass), pName)
.See Also: JavaSource
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(JavaQNameImpl.getInstance(pClass),
pFieldName, pGetMethodName, pSetMethodName)
.See Also: JavaSource
See Also: JavaSource
newJavaConstructor(Protection.valueOf(pProtection))
.newJavaConstructor(pConstructor, false)
.newJavaConstructor(pConstructor, false)
.
If the pSuper
argument is true, adds an
invocation of the super classes constructor with the
same arguments.newJavaField(pName, pType,
Protection.valueOf(pProtecttion)
.pMethod
.
More precise:
pMethod.getName()
.pMethod.getReturnType()
.pMethod
.
pMethod.getParameterTypes()
, calls
JavaMethod with the parameter names "p0", "p1", ...pMethod.getExceptionTypes()
, calls
JavaMethod.See Also: JavaSource
Parameters: pType "class" or "interface"
See Also: JavaSource