org.beanmaker
Class BeanCreator

java.lang.Object
  |
  +--org.beanmaker.Creator
        |
        +--org.beanmaker.BeanCreator
All Implemented Interfaces:
BeanMakerConstants

public class BeanCreator
extends Creator

BeanCreator creates the JavaBean writes it on the file. This operation is the result of parser operation of descriptor file (xml file).
The skeleton of the JavaBean is the following:
package com.foo; import java.sql.*;
public class nomeClasse {
declaration of the attributes
constructor ( public nomeClasse(){} )
declaration of get and set methods
end of class

Version:
1.2 07 Oct 2002
Author:
Martone Giovanni giovannimartone@hotmail.com
See Also:
Creator

Field Summary
 
Fields inherited from class org.beanmaker.Creator
CLASS_NAME, CLOSE_PARENTHESIS, DEFINITION_ATTRIBUTE, DEFINITION_CLASS, DEFINITION_METHOD, END_LINE, ESTENSION, EXTENDS, IMPLEMENTS, IMPORT, METHOD_GET, METHOD_GET_BOOLEAN, METHOD_SET, OPEN_PARENTHESIS, PACKAGE, PATH
 
Fields inherited from interface org.beanmaker.BeanMakerConstants
RETURN_CARRIAGE, TAB
 
Constructor Summary
BeanCreator(java.lang.String[] args)
          Constructs the object.
 
Method Summary
protected  java.lang.String buildAttribute(java.lang.String attributeType, java.lang.String attributeName)
          Creates the attribute in the following format private attributeType attributeName;
protected  java.lang.String buildConstructor(java.lang.String className)
          Creates the constructor.
protected  java.lang.String buildHeaderClass(java.lang.String beanName, java.lang.String superclass, java.util.ArrayList vInterfaces)
          Creates the signature of the class.
protected  java.lang.String buildMethod(java.lang.String typeMethod, java.lang.String type, java.lang.String attribute)
          Creates the set or get method (specify in typeMethod) of the property specified in attribute.
protected  void createBean(Bean bean, java.lang.String path)
          Handles the writing operations of the JavaBean
protected  java.lang.String createPath(java.lang.String sPackage, java.lang.String root)
          Creates the path where to save JavaBean
 java.util.ArrayList getBeans(Configuration conf)
           
 java.util.ArrayList getListValue(ConfigurationImpl root, java.lang.String name)
          Return a collection of value of configuration specified in name
 java.lang.String getSingleValue(ConfigurationImpl root, java.lang.String name)
          Return the single value of configuration specified in name
static void main(java.lang.String[] args)
           
 
Methods inherited from class org.beanmaker.Creator
formatAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanCreator

public BeanCreator(java.lang.String[] args)
Constructs the object.

Parameters:
args - the arguments that specify to BeanCreator where creates the JavaBean.
Method Detail

buildAttribute

protected java.lang.String buildAttribute(java.lang.String attributeType,
                                          java.lang.String attributeName)
Creates the attribute in the following format private attributeType attributeName;

Parameters:
attributeType - type of the attribute(es.String,int), attributeName name of the attribute
Returns:
String in the following format private attributeType attributeName;

buildConstructor

protected java.lang.String buildConstructor(java.lang.String className)
Creates the constructor. (es public className(){}).

Returns:
String the contains the constructor in the following format
(es public className(){}).

buildMethod

protected java.lang.String buildMethod(java.lang.String typeMethod,
                                       java.lang.String type,
                                       java.lang.String attribute)
Creates the set or get method (specify in typeMethod) of the property specified in attribute. (es public type typeMethod_attribute(....){....}).
If typeMethod is METHOD_GET the method is a getter method, if METHOD_SET the method is a setter method finally if it is METHOD_GET_BOOLEAN the method is a isXXX.

Returns:
String method created

buildHeaderClass

protected java.lang.String buildHeaderClass(java.lang.String beanName,
                                            java.lang.String superclass,
                                            java.util.ArrayList vInterfaces)
Creates the signature of the class. (es. public class beanName extends superclass implements interfaces). Format of the signature change on the basis of the following cases: 1) signature'll express in the following format public class beanName implements interfaces if the superclass is null, 2) signature'll express in the following format public class beanName extends superclass if interfaces is void, 3) signature 'll express in the following format public class beanName if superclass is null and interfaces is void.

Returns:
String signature of the class

createBean

protected void createBean(Bean bean,
                          java.lang.String path)
Handles the writing operations of the JavaBean

Parameters:
path - path where to save the JavaBean

createPath

protected java.lang.String createPath(java.lang.String sPackage,
                                      java.lang.String root)
Creates the path where to save JavaBean

Parameters:
sPackage - specifies the package nel file xml, command
Returns:
String path.

getBeans

public java.util.ArrayList getBeans(Configuration conf)
                             throws ConfigurationException
ConfigurationException

getListValue

public java.util.ArrayList getListValue(ConfigurationImpl root,
                                        java.lang.String name)
                                 throws ConfigurationException
Return a collection of value of configuration specified in name

Parameters:
root - Root configuration, name name of Configuration
Returns:
List collection of configuration
Throws:
ConfigurationException

getSingleValue

public java.lang.String getSingleValue(ConfigurationImpl root,
                                       java.lang.String name)
                                throws ConfigurationException
Return the single value of configuration specified in name

Parameters:
root - Root configuration, name name of Configuration
Returns:
String value of configuration
Throws:
ConfigurationException

main

public static void main(java.lang.String[] args)


Copyright © 2002 Giovanni Martone.