|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.deduced.controller.implementation.ControllerUtilities
public class ControllerUtilities

ControllerUtilities
| Nested Class Summary | |
|---|---|
static class |
ControllerUtilities.DynamicFileNameGenerator
DynamicFileNameFinder |
static interface |
ControllerUtilities.FileNameGenerator
FileNameGenerator |
static class |
ControllerUtilities.LocalClassLoader
LocalClassLoader is used to load locally compiled files. |
| Field Summary | |
|---|---|
private static boolean |
AUTOMATICALLY_DELETING_GENERATED_CLASS_FILES
option to automatically delete the compiled class file after they are loaded |
private static boolean |
AUTOMATICALLY_DELETING_GENERATED_JAVA_FILES
option to automatically delete generated JAVA files after compilation |
private static boolean |
AUTOMATICALLY_DELETING_GENERATED_JAVA_FILES_IF_COMPILE_FAILS
option to automatically delete java files when compilation fails |
static java.lang.String |
CLASS_FILE_EXTENSION
class file extension |
private static int |
COUNTER
counter used to increment the deduction rule class name |
static java.lang.String |
DEDUCED_DYNAMIC_CLASS_NAME
dynamic class name prefix |
static ControllerUtilities.FileNameGenerator |
FILE_NAME_GENERATOR
File name finder |
private static int |
FIND_AVAILABLE_FILE_MAX_ATTEMPT_COUNT
The maximum number of attempts at finding an available file |
static java.lang.String |
JAVA_FILE_EXTENSION
java file extension |
static ControllerUtilities.LocalClassLoader |
LOADER
class loader used to load deduction rules |
private static java.util.IdentityHashMap<PropertyCollection<?,?>,java.lang.Class<?>> |
RULE_TO_CLASS_MAP
map that associates rules to the class that executes them |
| Constructor Summary | |
|---|---|
ControllerUtilities()
|
|
| Method Summary | |
|---|---|
private static void |
buildRuleClassContent(PropertyCollection<?,?> rule,
java.lang.String className,
java.lang.String packageName,
java.lang.StringBuilder builder)
build Rule Class Content |
static void |
checkForErrorOnWriter(java.io.PrintWriter writer)
check For Error On Writer. |
static void |
compileClass(java.lang.String className,
java.lang.String javaFileName,
java.lang.String classFileName,
java.lang.String packageName,
java.lang.String classContent,
CompileResult result)
compile a class |
static boolean |
compileFile(java.io.File outFile,
CompileResult result)
compile a file |
static void |
deleteAllGeneratedClassFiles()
delete All Generated Class Files |
static void |
deleteAllGeneratedFiles()
delete All Generated Files |
static void |
deleteAllGeneratedJavaFiles()
delete All Generated Java Files |
static void |
deleteFileAssertIfFailed(java.io.File fileToDelete)
delete File Assert If Failed |
static PropertyCollectionController |
findCollectionControllerControllingModel(PropertyCollection collectionControllerList,
PropertyCollection controlledModel)
find Collection Controller Controlling Model |
static PropertyController |
findPropertyControllerControllingPropertyKey(PropertyCollection propertyControllerList,
java.lang.Object controlledKey)
find Property Controller Controlling Property Key |
static void |
getClassFromRule(PropertyCollection rule,
CompileResult result)
get Class From Rule |
static java.lang.String |
getNextAvailableDynamicFileName()
get Next Available Dynamic File Name will test if a file name is already in use before returning it. |
protected static java.lang.String |
getNextAvailableFileName(ControllerUtilities.FileNameGenerator generator)
get Next Available File Name |
static java.lang.String |
getNextDynamicFileName()
get a dynamic file name used to store deduction rules |
static java.lang.String |
getRuleMethodName(PropertyCollection<?,?> rule)
get Rule Method Name |
static boolean |
isAutomaticallyDeletingGeneratedClassFiles()
|
static boolean |
isAutomaticallyDeletingGeneratedJavaFiles()
|
static boolean |
isAutomaticallyDeletingGeneratedJavaFilesIfCompileFails()
|
static boolean |
isClassName(java.lang.String codeClassName)
test if the code points to a class name or not. |
static boolean |
isReferenceMultiple(java.util.List<?> instanceList)
test if a reference can result in multiple values |
static boolean |
isValidMethodNameCharacter(char value)
test if a character is valid for a java method name |
private static void |
printReferenceClassType(java.lang.StringBuilder builder,
PropertyCollection<?,?> instanceReference)
print Reference Class Type |
private static void |
printRuleClassHeader(java.lang.String className,
java.lang.String packageName,
java.lang.StringBuilder builder)
print Rule Class Header |
private static void |
printRuleGenericMethod(PropertyCollection<?,?> rule,
java.lang.StringBuilder builder)
print Rule Generic Method |
private static void |
printRuleSpecificMethod(PropertyCollection<?,?> rule,
java.lang.StringBuilder builder)
print Rule Specific Method |
static void |
resetClassFromRule(PropertyCollection<?,?> rule)
reset Class From Rule |
static void |
setAutomaticallyDeletingGeneratedClassFiles(boolean setAutomaticallyDeletingGeneratedClassFiles)
|
static void |
setAutomaticallyDeletingGeneratedJavaFiles(boolean setAutomaticallyDeletingGeneratedJavaFiles)
|
static void |
setAutomaticallyDeletingGeneratedJavaFilesIfCompileFails(boolean setAutomaticallyDeletingGeneratedJavaFilesIfCompileFails)
|
static void |
setControllerEnabled(PropertyCollectionController controller,
boolean isEnabled)
Modify a controller and all it's children to enable or disable them. |
static void |
setControllerEnabled(PropertyController controller,
boolean isEnabled)
Modify a property controller to enable or disable it |
static java.io.File |
writeJavaClass(java.lang.String fileName,
java.lang.String classContent)
write a Java Class |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int FIND_AVAILABLE_FILE_MAX_ATTEMPT_COUNT
public static final java.lang.String CLASS_FILE_EXTENSION
public static final java.lang.String JAVA_FILE_EXTENSION
public static final java.lang.String DEDUCED_DYNAMIC_CLASS_NAME
private static boolean AUTOMATICALLY_DELETING_GENERATED_JAVA_FILES
private static boolean AUTOMATICALLY_DELETING_GENERATED_CLASS_FILES
private static boolean AUTOMATICALLY_DELETING_GENERATED_JAVA_FILES_IF_COMPILE_FAILS
private static java.util.IdentityHashMap<PropertyCollection<?,?>,java.lang.Class<?>> RULE_TO_CLASS_MAP
private static int COUNTER
public static final ControllerUtilities.FileNameGenerator FILE_NAME_GENERATOR
public static final ControllerUtilities.LocalClassLoader LOADER
| Constructor Detail |
|---|
public ControllerUtilities()
| Method Detail |
|---|
public static void deleteAllGeneratedFiles()
public static void deleteAllGeneratedJavaFiles()
public static void deleteAllGeneratedClassFiles()
public static void setControllerEnabled(PropertyCollectionController controller,
boolean isEnabled)
controller - the controller to modifyisEnabled - is the controller enabled
public static void setControllerEnabled(PropertyController controller,
boolean isEnabled)
controller - the controller to modifyisEnabled - is the controller enabled or not
public static void compileClass(java.lang.String className,
java.lang.String javaFileName,
java.lang.String classFileName,
java.lang.String packageName,
java.lang.String classContent,
CompileResult result)
className - the name of the class to compilejavaFileName - name of the java file to useclassFileName - name of the class file to usepackageName - name of the package for the classclassContent - content of the classresult - the compilation result to fill while compilingpublic static void deleteFileAssertIfFailed(java.io.File fileToDelete)
fileToDelete - file to delete
public static boolean compileFile(java.io.File outFile,
CompileResult result)
throws java.io.IOException
outFile - file to compileresult - the compilation result to fill
java.io.IOException - any exception generated while running the compiler
public static java.io.File writeJavaClass(java.lang.String fileName,
java.lang.String classContent)
throws java.io.IOException
fileName - the file name to useclassContent - the class content
java.io.IOException - if writing the file failspublic static void checkForErrorOnWriter(java.io.PrintWriter writer)
writer - the writer to verify.
private static void buildRuleClassContent(PropertyCollection<?,?> rule,
java.lang.String className,
java.lang.String packageName,
java.lang.StringBuilder builder)
rule - the rule to buildclassName - the class name to usepackageName - the package name to usebuilder - the string builder in which to write the class content
private static void printRuleSpecificMethod(PropertyCollection<?,?> rule,
java.lang.StringBuilder builder)
rule - the rule to printbuilder - the string builder in which to write the class contentpublic static java.lang.String getRuleMethodName(PropertyCollection<?,?> rule)
rule - the rule from which to extract the method name
public static boolean isValidMethodNameCharacter(char value)
value - the character to test
private static void printReferenceClassType(java.lang.StringBuilder builder,
PropertyCollection<?,?> instanceReference)
builder - string builder in which to print the contentinstanceReference - the instance reference to printpublic static boolean isReferenceMultiple(java.util.List<?> instanceList)
instanceList - the instance list
private static void printRuleGenericMethod(PropertyCollection<?,?> rule,
java.lang.StringBuilder builder)
rule - the rule to printbuilder - the string builder in which to print the content
private static void printRuleClassHeader(java.lang.String className,
java.lang.String packageName,
java.lang.StringBuilder builder)
className - the class namepackageName - the package namebuilder - the string builder in which to print the contentpublic static void resetClassFromRule(PropertyCollection<?,?> rule)
rule - the rule to reset
public static void getClassFromRule(PropertyCollection rule,
CompileResult result)
rule - the ruleresult - the compilation result containing the class that will be
returned.public static boolean isClassName(java.lang.String codeClassName)
codeClassName - the class name to test
public static java.lang.String getNextDynamicFileName()
public static java.lang.String getNextAvailableDynamicFileName()
protected static java.lang.String getNextAvailableFileName(ControllerUtilities.FileNameGenerator generator)
generator - name finder
public static PropertyCollectionController findCollectionControllerControllingModel(PropertyCollection collectionControllerList,
PropertyCollection controlledModel)
collectionControllerList - the collection controller listcontrolledModel - the controlled model to find
public static PropertyController findPropertyControllerControllingPropertyKey(PropertyCollection propertyControllerList,
java.lang.Object controlledKey)
propertyControllerList - the collection controller listcontrolledKey - the controlled property key to find
public static void setAutomaticallyDeletingGeneratedJavaFiles(boolean setAutomaticallyDeletingGeneratedJavaFiles)
setAutomaticallyDeletingGeneratedJavaFiles - the Automatically
Deleting Generated Java Files flagpublic static boolean isAutomaticallyDeletingGeneratedJavaFiles()
public static void setAutomaticallyDeletingGeneratedClassFiles(boolean setAutomaticallyDeletingGeneratedClassFiles)
setAutomaticallyDeletingGeneratedClassFiles - the Automatically
Deleting Generated Class Files flagpublic static boolean isAutomaticallyDeletingGeneratedClassFiles()
public static void setAutomaticallyDeletingGeneratedJavaFilesIfCompileFails(boolean setAutomaticallyDeletingGeneratedJavaFilesIfCompileFails)
setAutomaticallyDeletingGeneratedJavaFilesIfCompileFails - the
Automatically Deleting Generated Java Files if compile fails
flagpublic static boolean isAutomaticallyDeletingGeneratedJavaFilesIfCompileFails()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||