Methods Summary |
---|
public java.lang.Object | createObject(java.lang.String type)Creates an instance of the given type.
Uses constructor with no arguments to instantiate the type object.
Object object = null;
try {
Class classObject = Class.forName(type);
object = classObject.newInstance();
} catch (InstantiationException e) {
System.out.println(e);
} catch (IllegalAccessException e) {
System.out.println(e);
} catch (ClassNotFoundException e) {
System.out.println(e);
}
return object;
|
public java.lang.Object | createObject(java.lang.Class classObject)Creates an instance of the type; given the Class
object of the type. Uses constructor with no arguments to
instantiate the type object.
Object object = null;
try {
object = classObject.newInstance();
} catch (InstantiationException e) {
System.out.println(e);
} catch (IllegalAccessException e) {
System.out.println(e);
}
return object;
|
public java.lang.Object | createObject(java.lang.reflect.Constructor constructor, java.lang.Object[] arguments)Creates an instance of the type; given the Constructor
object of the type and the array of argument values.
Uses constructor, represented by the input Constructor
object.
//System.out.println ("Constructor: " + constructor.toString());
Object object = null;
try {
object = constructor.newInstance(arguments);
//System.out.println ("Object: " + object.toString());
return object;
} catch (InstantiationException e) {
System.out.println(e);
} catch (IllegalAccessException e) {
System.out.println(e);
} catch (IllegalArgumentException e) {
System.out.println(e);
} catch (InvocationTargetException e) {
System.out.println(e);
}
return object;
|
public java.lang.String | eleminateHypen(java.lang.String string)Removes any hypens ( - ) from the given string.
When it removes a hypen, it converts next immidiate
character, if any, to an Uppercase.(schema2beans convention)
if(!(string == null || string.length() <= 0)){
int index = string.indexOf('-");
while(index != -1){
if(index == 0){
string = string.substring(1);
} else {
if(index == (string.length() - 1)){
string = string.substring(0,string.length()-1);
} else {
string = string.substring(0,index) +
upperCaseFirstLetter(string.substring(index + 1));
}
}
index = string.indexOf('-");
}
}
return string;
|
public boolean | fileExists(java.lang.String relativePath)Determines if the given file exists.
boolean returnValue = false;
InputStream inputStream = getInputStream(relativePath);
if(inputStream != null){
returnValue = true;
}
return returnValue;
|
public java.lang.Class | getClass(java.lang.Object object)Gets a Class object of the given Object .
Class classObject = null;
classObject = object.getClass();
///System.out.println(classObject.toString());
return classObject;
|
public java.lang.Class | getClass(java.lang.String type)Gets a Class object of the given type.
Class classObject = null;
try {
classObject = Class.forName(type);
} catch (ClassNotFoundException e) {
System.out.println(e);
}
return classObject;
|
public java.lang.reflect.Constructor | getConstructor(java.lang.String type, java.lang.Class[] argumentClass)Gets a corresponding Constructor object of a given type,
based on the Class objects of the arguments.
Constructor object represents constructor which takes arguments
represented by argumentClass array.
Constructor constructor = null;
Class classObject = getClass(type);
try {
constructor = classObject.getConstructor(argumentClass);
} catch (NoSuchMethodException e) {
System.out.println(e);
}
return constructor;
|
public java.lang.reflect.Constructor | getConstructor(java.lang.Class classObject, java.lang.Class[] argumentClass)Gets a corresponding Constructor object of a given type,
based on the Class objects of the arguments.
Constructor object represents constructor which takes arguments
represented by argumentClass array.
Constructor constructor = null;
try {
constructor = classObject.getConstructor(argumentClass);
} catch (NoSuchMethodException e) {
System.out.println(e);
}
return constructor;
|
public java.lang.Object | getElement(java.lang.String elementName, java.lang.Object object)Gets an element from the given Object ;
given the name of the element.
//Consvert the first letter of elementName to Uppercase
//Construct method name by appending given "get" to elementName //NOI18N
//Invoke this method on object to get the required value
if((null == object) || (null == elementName) ||
(elementName.length() <= 0)){
return null;
}
String methodName =
methodNameFromDtdName(elementName, GET_PREFIX); //NOI18N
Method getMethod = null;
getMethod = getMethod(getClass(object), methodName);
return invoke(object, getMethod);
|
public java.lang.Object | getElement(java.lang.String elementName, int index, java.lang.Object object)Gets an element at a given index, from the given Object ;
given the name of the element.
//Consvert the first letter of elementName to Uppercase
//Construct method name by appending given "get" to elementName //NOI18N
//Invoke this method on object to get the required value
if((null == object) || (null == elementName) ||
(elementName.length() <= 0) || (index < 0)){
return null;
}
String methodName =
methodNameFromDtdName(elementName, GET_PREFIX); //NOI18N
Class[] argumentTypes = new Class[] {int.class};
Method getMethod = null;
getMethod = getMethod(getClass(object), methodName,
argumentTypes);
Integer in = new Integer(index);
Object[] argumentValues = new Object[] {in};
return invoke(object, getMethod, argumentValues);
|
public java.lang.Object | getElement(java.lang.String elementName, java.lang.Object object, java.lang.String prefix)Gets an element from the given Object ;
given the name of the element and prefix to use to for the method name.
//Consvert the first letter of elementName to Uppercase
//Construct method name by appending given "perfix" to elementName
//Invoke this method on object to get the required value
if((null == object) || (null == elementName) ||
(elementName.length() <= 0)){
return null;
}
String returnValue = null;
String methodName =
methodNameFromDtdName(elementName, prefix);
Class classObject = getClass(object);
Method method = getMethod(classObject, methodName);
return (Integer) invoke(object, method);
|
public java.lang.Object[] | getElements(java.lang.String elementName, java.lang.Object object)Gets the elements from the given Object ;
given the name of the element.
return (Object[]) getElement(elementName, object);
|
public java.lang.String | getIndexedName(java.lang.String name, int index)Gets an indexed name from a given name and index.
if(name != null) {
String format =
BundleReader.getValue("Indexed_Name_Format"); //NOI18N
Object[] arguments = new Object[]{name, String.valueOf(index)};
name = MessageFormat.format(format, arguments);
}
return name;
|
public java.io.InputStream | getInputStream(java.lang.String relavtiveFilePath)Gets an input stream for the given file.
InputStream inputStream = null;
URL url = null;
if(relavtiveFilePath != null){
url = getUrlObject(relavtiveFilePath);
if(url != null) {
try {
inputStream = url.openStream();
} catch (IOException exception){
System.out.println(exception.getMessage());
}
} else {
String format =
BundleReader.getValue("Error_does_not_exists"); //NOI18N
Object[] arguments =
new Object[]{"File", relavtiveFilePath}; //NOI18N
System.out.println(MessageFormat.format(format, arguments));
}
}
return inputStream;
|
public java.lang.reflect.Method | getMethod(java.lang.String type, java.lang.String methodName, java.lang.Class[] argumentClass)Gets a Method object of a given type, based on method name and
the Class objects of the arguments.
Method method = null;
Class classObject = getClass(type);
try {
method = classObject.getMethod(methodName, argumentClass);
} catch (NoSuchMethodException e) {
System.out.println(e);
}
return method;
|
public java.lang.reflect.Method | getMethod(java.lang.Class classObject, java.lang.String methodName, java.lang.Class[] argumentClass)Gets a Method object of a given type, based on method name and
the Class objects of the arguments.
Method method = null;
try {
method = classObject.getMethod(methodName, argumentClass);
} catch (NoSuchMethodException e) {
System.out.println(e);
}
return method;
|
public java.lang.reflect.Method | getMethod(java.lang.String type, java.lang.String methodName)Gets the Method object of the given
type; given the method name.
Method method = null;
Class classObject = getClass(type);
try {
method = classObject.getMethod(methodName, null);
} catch (NoSuchMethodException e) {
System.out.println(e);
}
return method;
|
public java.lang.reflect.Method | getMethod(java.lang.Class classObject, java.lang.String methodName)Gets the Method object of the given
type; given the method name.
Method method = null;
try {
method = classObject.getMethod(methodName, null);
} catch (NoSuchMethodException e) {
System.out.println(e);
}
return method;
|
public java.lang.String | getName(java.lang.String absoluteName, int delimiter)Gets the name from the absolute name/path
if(null == absoluteName){
return absoluteName;
}
int index = absoluteName.lastIndexOf(delimiter);
if( index != -1) {
index = index + 1;
return absoluteName.substring(index);
} else {
return absoluteName;
}
|
public java.lang.String | getParentName(java.lang.String absoluteName, int delimiter)Gets the parent of the given absolute name
if(null == absoluteName){
return absoluteName;
}
int endIndex = absoluteName.lastIndexOf(delimiter);
if(endIndex != -1){
if(0 == endIndex){
return null;
} else {
return absoluteName.substring(0, endIndex);
}
} else {
return null;
}
|
public java.net.URL | getUrlObject(java.lang.String relativePath)Gets an Url object for a given relative path.
Class cl = getClass();
ClassLoader classLoader = cl.getClassLoader();
return classLoader.getResource(relativePath);
|
public java.lang.Object | invoke(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object[] arguments)Invokes the method, on the given object with the given arguments.
Invokes method, represented by the Method object.
Object result = null;
try {
result = method.invoke(object, arguments);
} catch (IllegalAccessException e) {
System.out.println(e);
} catch (InvocationTargetException e) {
System.out.println(e);
}
return result;
|
public java.lang.Object | invoke(java.lang.Object object, java.lang.reflect.Method method)Invokes the method, on the given object.
Invokes method, represented by the Method object.
Object result = null;
try {
result = method.invoke(object, null);
} catch (IllegalAccessException e) {
System.out.println(e);
} catch (InvocationTargetException e) {
System.out.println(e);
}
return result;
|
public java.lang.String | methodNameFromBeanName(java.lang.String elementName, java.lang.String prefix)Constructs a method name from element's bean
name for a given prefix.(schema2beans convention)
if((null == elementName) || (null == prefix) ||
(prefix.length() <= 0 )){
return elementName;
}
String methodName = upperCaseFirstLetter(elementName);
return methodName = prefix + methodName;
|
public java.lang.String | methodNameFromDtdName(java.lang.String elementName, java.lang.String prefix)Constructs a method name from element's dtd name
name for a given prefix.(schema2beans convention)
return methodNameFromBeanName(eleminateHypen(elementName), prefix);
|
public java.lang.String | upperCaseFirstLetter(java.lang.String string)Converts the first letter of the given string to Uppercase.
if(string == null || string.length() <= 0){
return string;
}
return string.substring(0, 1).toUpperCase() + string.substring(1);
|