com.sibvisions.util
Class SimpleJavaSource

java.lang.Object
  extended by com.sibvisions.util.SimpleJavaSource

public class SimpleJavaSource
extends java.lang.Object

The SimpleJavaSource interprets Java Source.


Field Summary
protected  java.util.Map<java.lang.String,java.lang.String> archiveClassListMap
          Imports to find Java Classes.
protected  java.util.List<java.lang.Class<?>> classesWithConstants
          The Name for constants.
protected  java.lang.ClassLoader classLoader
          The classloader for class loading.
protected  java.util.Map<java.lang.Class<?>,java.util.List<java.lang.String>> ignoreProperties
          Class forName.
protected  java.util.ArrayList<java.lang.String> imports
          Imports to find Java Classes.
protected  java.util.Map<java.lang.Object,java.lang.String> instanceNames
          The Name for any instance.
protected  java.util.Map<java.lang.String,java.lang.Object> instances
          All known instances.
protected  java.util.Map<java.lang.String,java.lang.Class<?>> simpleClassNameClasses
          Class forName.
protected static java.lang.StringBuilder tempBuilder
          Static temporary string builder, to avoid heap consumption.
protected  java.util.List<java.lang.Object> tempTags
          Parsed Tags Cache.
 
Constructor Summary
SimpleJavaSource()
          Constructs a new SimpleJavaSource.
 
Method Summary
 void addClassWithConstants(java.lang.Class<?> pClass)
          Adds class to constant classes.
 void addImport(java.lang.String pImport)
          Adds an import statement to find simple class names.
 java.lang.Object execute(java.lang.String pSource)
          Executes any java statement.
 java.util.List<java.lang.String> getArchiveClassList()
          Gets the archive class list to find classes with simple class name without class loader.
 java.lang.Class<?> getClassByName(java.lang.String pClassName)
          Gets the class for the given name.
 java.lang.Class<?> getClassByName(java.lang.String pClassName, boolean pSimpleClassName)
          Gets the class for the given class name.
 java.lang.Class<?>[] getClassesWithConstants()
          Gets all classes from constant classes.
 java.lang.ClassLoader getClassLoader()
          Gets the class loader.
 java.lang.Class<?> getComponentType(java.lang.Class<?> pComponentType, int pDimension)
          Gets the array class with the given dimension.
 java.lang.String getFieldName(java.lang.Object pInstance)
          Gets the name for a instance.
 java.lang.String[] getFieldNames()
          Gets all fields.
 java.lang.Object getFieldValue(java.lang.String pFieldName)
          Gets the instance for a specific field.
 java.util.List<java.lang.String> getIgnorePropertyDefinition(java.lang.Class<?> pSuperClass)
          Gets the properties to ignore.
 java.util.List<java.lang.String> getImports()
          Gets all import statements.
 boolean isPropertyIgnored(java.lang.Object pInstance, java.lang.String pPropertyName)
          True, if the given property has to be ignored.
 boolean isPropertySet(java.lang.Object pInstance, java.lang.String pPropertyName)
          True, if the given property is detected as set with isXxxSet.
 void removeAllImports()
          Removes all import statement.
 void removeClassWithConstants(java.lang.Class<?> pClass)
          Removes class from constant classes.
 void removeField(java.lang.String pFieldName)
          Removes the specific field.
 void removeImport(java.lang.String pImport)
          Removes an import statement.
 void setArchiveClassList(java.util.List<java.lang.String> pArchiveClassList)
          Sets the archive class list to find classes with simple class name without class loader.
 void setClassLoader(java.lang.ClassLoader pClassLoader)
          Sets the class loader.
 void setFieldValue(java.lang.String pFieldName, java.lang.Object pInstance)
          Sets the instance for a specific field.
 void setIgnorePropertyDefinition(java.lang.Class<?> pSuperClass, java.util.List<java.lang.String> pIgnoreProperties)
          Gets the properties to ignore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tempBuilder

protected static java.lang.StringBuilder tempBuilder
Static temporary string builder, to avoid heap consumption.


classesWithConstants

protected java.util.List<java.lang.Class<?>> classesWithConstants
The Name for constants.


imports

protected java.util.ArrayList<java.lang.String> imports
Imports to find Java Classes.


ignoreProperties

protected java.util.Map<java.lang.Class<?>,java.util.List<java.lang.String>> ignoreProperties
Class forName.


archiveClassListMap

protected java.util.Map<java.lang.String,java.lang.String> archiveClassListMap
Imports to find Java Classes.


simpleClassNameClasses

protected java.util.Map<java.lang.String,java.lang.Class<?>> simpleClassNameClasses
Class forName.


tempTags

protected java.util.List<java.lang.Object> tempTags
Parsed Tags Cache.


instances

protected java.util.Map<java.lang.String,java.lang.Object> instances
All known instances.


instanceNames

protected java.util.Map<java.lang.Object,java.lang.String> instanceNames
The Name for any instance.


classLoader

protected java.lang.ClassLoader classLoader
The classloader for class loading.

Constructor Detail

SimpleJavaSource

public SimpleJavaSource()
Constructs a new SimpleJavaSource.

Method Detail

setClassLoader

public void setClassLoader(java.lang.ClassLoader pClassLoader)
Sets the class loader.

Parameters:
pClassLoader - the class loader.

getArchiveClassList

public java.util.List<java.lang.String> getArchiveClassList()
Gets the archive class list to find classes with simple class name without class loader.

Returns:
the archive class list.

setArchiveClassList

public void setArchiveClassList(java.util.List<java.lang.String> pArchiveClassList)
Sets the archive class list to find classes with simple class name without class loader.

Parameters:
pArchiveClassList - the archive class list.

getClassLoader

public java.lang.ClassLoader getClassLoader()
Gets the class loader.

Returns:
the class loader.

addClassWithConstants

public void addClassWithConstants(java.lang.Class<?> pClass)
Adds class to constant classes.

Parameters:
pClass - the class to add.

removeClassWithConstants

public void removeClassWithConstants(java.lang.Class<?> pClass)
Removes class from constant classes.

Parameters:
pClass - the class to remove.

getClassesWithConstants

public java.lang.Class<?>[] getClassesWithConstants()
Gets all classes from constant classes.

Returns:
pClass the class to remove.

addImport

public void addImport(java.lang.String pImport)
Adds an import statement to find simple class names.

Parameters:
pImport - the import.

removeImport

public void removeImport(java.lang.String pImport)
Removes an import statement.

Parameters:
pImport - the class.

removeAllImports

public void removeAllImports()
Removes all import statement.


getImports

public java.util.List<java.lang.String> getImports()
Gets all import statements.

Returns:
all import statements.

getIgnorePropertyDefinition

public java.util.List<java.lang.String> getIgnorePropertyDefinition(java.lang.Class<?> pSuperClass)
Gets the properties to ignore.

Parameters:
pSuperClass - the super class
Returns:
the properties to ignore.

setIgnorePropertyDefinition

public void setIgnorePropertyDefinition(java.lang.Class<?> pSuperClass,
                                        java.util.List<java.lang.String> pIgnoreProperties)
Gets the properties to ignore.

Parameters:
pSuperClass - the super class
pIgnoreProperties - the properties to ignore.

isPropertyIgnored

public boolean isPropertyIgnored(java.lang.Object pInstance,
                                 java.lang.String pPropertyName)
True, if the given property has to be ignored.

Parameters:
pInstance - the instance.
pPropertyName - the property.
Returns:
True, if the given property has to be ignored.

isPropertySet

public boolean isPropertySet(java.lang.Object pInstance,
                             java.lang.String pPropertyName)
True, if the given property is detected as set with isXxxSet.

Parameters:
pInstance - the instance.
pPropertyName - the property.
Returns:
True, if the given property is detected as set with isXxxSet.

getFieldValue

public java.lang.Object getFieldValue(java.lang.String pFieldName)
Gets the instance for a specific field.

Parameters:
pFieldName - the field name.
Returns:
the instance.

setFieldValue

public void setFieldValue(java.lang.String pFieldName,
                          java.lang.Object pInstance)
Sets the instance for a specific field.

Parameters:
pFieldName - the field name.
pInstance - the instance.

getFieldName

public java.lang.String getFieldName(java.lang.Object pInstance)
Gets the name for a instance.

Parameters:
pInstance - the field name.
Returns:
the instance.

removeField

public void removeField(java.lang.String pFieldName)
Removes the specific field.

Parameters:
pFieldName - the field name.

getFieldNames

public java.lang.String[] getFieldNames()
Gets all fields.

Returns:
all fields.

execute

public java.lang.Object execute(java.lang.String pSource)
Executes any java statement.

Parameters:
pSource - the source.
Returns:
the result.

getClassByName

public java.lang.Class<?> getClassByName(java.lang.String pClassName,
                                         boolean pSimpleClassName)
Gets the class for the given class name.

Parameters:
pClassName - the class name
pSimpleClassName - true if the name is a simple class name, false otherwise
Returns:
the class or null if no class with given name was found

getClassByName

public java.lang.Class<?> getClassByName(java.lang.String pClassName)
Gets the class for the given name.

Parameters:
pClassName - the full qualified class name
Returns:
the class or null if no class with given name was found

getComponentType

public java.lang.Class<?> getComponentType(java.lang.Class<?> pComponentType,
                                           int pDimension)
Gets the array class with the given dimension.

Parameters:
pComponentType - the simple class name.
pDimension - the array dimension.
Returns:
the class.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.