Class Execution
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class indicates a non existing value in the name-to-value mapping. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddShutdownHook(Runnable hook) Registers a new virtual-machine shutdown hook.static voidaddShutdownHook(Thread hook) Registers a new virtual-machine shutdown hook.static Set<Annotation> annotations(Class<?> aClass) Gatherers all annotations annotating a providedClass.static Set<Annotation> annotations(Object aObj) Gatherers all annotations annotating a providedObject.static Set<Annotation> annotations(Field aField) Gatherers all annotations annotating a providedField.static Set<Annotation> annotations(Method aMethod) Gatherers all annotations annotating a providedMethod.protected static booleancontainsDir(File aDir, List<File>... aDirs) Contains dir.static AnnotationfindAnnotation(Class<? extends Annotation> aAnnotation, Class<?> aClass) Seeks for anAnnotationof the given type annotating a providedClass, also reckoning annotations nested inside annotations (recursively).static AnnotationfindAnnotation(Class<? extends Annotation> aAnnotation, Object aObj) Seeks for anAnnotationof the given type annotating a providedObject, also reckoning annotations nested inside annotations (recursively).static AnnotationfindAnnotation(Class<? extends Annotation> aAnnotation, Field aField) Seeks for anAnnotationof the given type annotating a providedField, also reckoning annotations nested inside annotations (recursively).static AnnotationfindAnnotation(Class<? extends Annotation> aAnnotation, Method aMethod) Seeks for anAnnotationof the given type annotating a providedMethod, also reckoning annotations nested inside annotations (recursively).static StackTraceElementReturns theStackTraceElementbelonging to the direct caller of this method.static StackTraceElementgetCallerStackTraceElement(Class<?> aCallee) Returns theStackTraceElementbelonging to the caller of the callee.static StackTraceElementgetCallerStackTraceElement(Class<?>... aCallees) Same asgetCallerStackTraceElement(Class)with the difference that the passed callees are tried out one after the other until the first caller determined for a callee is returned.static StackTraceElementReturns theStackTraceElementbelonging to the caller of the callee.static StackTraceElementgetCallerStackTraceElement(StackTraceElement... aCallees) Same asgetCallerStackTraceElement(StackTraceElement)with the difference that the passed callees are tried out one after the other until the first caller determined for a callee is returned.static StackTraceElementgetCallerStackTraceElement(String aCalleeClassName) Returns theStackTraceElementbelonging to the caller of the callee.static StackTraceElementgetCallerStackTraceElement(String... aCalleeClassNames) Same asgetCallerStackTraceElement(String)with the difference that the passed callees are tried out one after the other until the first caller determined for a callee is returned.static Class<?> Returns the type of the (Class) belonging to the direct caller of this method.static Class<?> getCallerType(Class<?> aCallee) Returns the type of the (Class) belonging to the caller of the callee.static Class<?> getCallerType(Class<?>... aCallees) Same asgetCallerType(Class)with the difference that the passed callees are tried out one after the other until the first caller determined for a callee is returned.static Class<?> getCallerType(StackTraceElement aCallee) Returns the type of the (Class) belonging to the caller of the callee.static Class<?> getCallerType(StackTraceElement... aCallees) Same asgetCallerType(StackTraceElement)with the difference that the passed callees are tried out one after the other until the first caller determined for a callee is returned.static Class<?> getCallerType(String aCallee) Returns the type of the (Class) belonging to the caller of the callee.static Class<?> getCallerType(String... aCallees) Same asgetCallerType(String)with the difference that the passed callees are tried out one after the other until the first caller determined for a callee is returned.static ClassReturns the main class launching the application.static booleanhasAnnotation(Class<? extends Annotation> aAnnotation, Class<?> aClass) Tests if anAnnotationof the given type annotates a providedClass, also reckoning annotations nested inside annotations (recursively).static booleanhasAnnotation(Class<? extends Annotation> aAnnotation, Object aObj) Tests if anAnnotationof the given type annotates a providedObject, also reckoning annotations nested inside annotations (recursively).static booleanhasAnnotation(Class<? extends Annotation> aAnnotation, Field aField) Tests if anAnnotationof the given type annotates a providedField, also reckoning annotations nested inside annotations (recursively).static booleanhasAnnotation(Class<? extends Annotation> aAnnotation, Method aMethod) Tests if anAnnotationof the given type annotates a providedMethod, also reckoning annotations nested inside annotations (recursively).static booleanhasGetterAttribute(Object anObject, String anAttributeName, Class<?> aReturnType) This method tests whether the given java beans getter attribute is found for the given object.static booleanhasSetterAttribute(Object anObject, String anAttributeName, Class<?> anAttributeType) This method tests whether the given java beans setter attribute is found for the given object.static booleanDetermines whether we are inside an executing native image, e.g. theSystemProperty.NATIVE_IMAGE_CODE's value evaluates toNativeImageCode.RUNTIME's value.static booleanDetermines whether this code is executed from inside a unit test or not.static StackTraceElementprobeTillNoneLoggerElement(Class<?>... aCallees) Try to skip any logging framework's factory or whatsoeverStackTraceElementinstances.static voidsetAttribute(Object anObject, String anAttributeName, Object anAttributeValue) This method sets a java beans attribute for the given object.static voidsetAttribute(Object anObject, org.refcodes.struct.Attribute anAttributeValueStruct) This method sets a java beans attribute for the given object.static voidsetJulLoggingHandler(Handler aHandler) Redirects theLoggerconfiguration and sets the provided handler.static voidsetJulLoggingLevel(Level aLevel) static voidsetJulLoggingStreams(OutputStream aStdStream, OutputStream aErrStream, Level aLevel) Redirects theLoggerconfiguration to the provided streams.static org.refcodes.struct.Attribute[]toBeanAttributes(Object anObject) This method uses reflection on order to analyze a given object.static PrintStreamReturns the originalPrintStreamfor STDERR as initialized by the JVM at bootstrapping time (theSystem.errPrintStreammay have got modified by libraries or frameworks in the meanwhile).static InputStreamReturns the originalInputStreamfor STDIN as initialized by the JVM at bootstrapping time (theSystem.inInputStreammay have got modified by libraries or frameworks in the meanwhile).static PrintStreamReturns the originalPrintStreamfor STDOUT as initialized by the JVM at bootstrapping time (theSystem.outPrintStreammay have got modified by libraries or frameworks).static Class<?> toClass(StackTraceElement aStackTraceElement) Retrieves theClasstype to which theStackTraceElementbelongs.static StringRetrieves the class name of the caller of this method without the fully qualified package name part.static StringtoClassName(StackTraceElement aStackTraceElement) Returns the class name part from aStackTraceElement.static StringtoClassName(String aFullyQualifiedClassName) Returns the class name part from a fully qualified class name (which has the fully qualified package name as part of its name).static <T> TtoClone(T aObj) static StringRetrieves the fully qualified method name of the caller of this method.static StringtoFullyQualifiedClassName(StackTraceElement aStackTraceElement) Retrieves the fully qualified class name from aStackTraceElement.static StringRetrieves the fully qualified method name of the caller of this method.static StringtoFullyQualifiedMethodName(StackTraceElement aStackTraceElement) Retrieves the fully qualified method name from aStackTraceElement.static StringRetrieves the fully qualified package name of the caller of this method without the class name part.static StringtoFullyQualifiedPackageName(StackTraceElement aStackTraceElement) Retrieves the fully qualified package name from aStackTraceElement.static StringtoFullyQualifiedPackageName(String aFullyQualifiedClassName) Returns the fully qualified package name part from a fully qualified class name (which has the fully qualified package name as part of its name).static StackTraceElementtoHeurisitcCallerStackTraceElement(Class<?> aCallee) Returns the best matchingStackTraceElementbelonging to the caller of the callee.The "best matching"StackTraceElementis considered to be the one not belonging to any "internal" API in a package namespace such as "com.sun.*", "java.*" or "javax.*".static StackTraceElementtoHeurisitcCallerStackTraceElement(Class<?>[] aCallees) Returns the best matchingStackTraceElementbelonging to the caller of one of the callees (in the order passed to the method).The "best matching"StackTraceElementis considered to be the one not belonging to any "internal" API in a package namespace such as "com.sun.*", "java.*" or "javax.*".static StackTraceElementReturns the best matchingStackTraceElementbelonging to the caller of the callee.The "best matching"StackTraceElementis considered to be the one not belonging to any "internal" API in a package namespace such as "com.sun.*", "java.*" or "javax.*".static StackTraceElementtoHeurisitcCallerStackTraceElement(StackTraceElement[] aCallees) Returns the best matchingStackTraceElementbelonging to the caller of one of the callees (in the order passed to the method).The "best matching"StackTraceElementis considered to be the one not belonging to any "internal" API in a package namespace such as "com.sun.*", "java.*" or "javax.*".static StackTraceElementtoHeurisitcCallerStackTraceElement(String aCalleeClassName) Returns the best matchingStackTraceElementbelonging to the caller of the callee.static StackTraceElementtoHeurisitcCallerStackTraceElement(String[] aCallees) Returns the best matchingStackTraceElementbelonging to the caller of one of the callees (in the order passed to the method).The "best matching"StackTraceElementis considered to be the one not belonging to any "internal" API in a package namespace such as "com.sun.*", "java.*" or "javax.*".static FileGenerates the base path relative to the given class location.static StringRetrieves the fully qualified method name of the caller of this method.static StringtoMethodName(StackTraceElement aStackTraceElement) Retrieves the method name from aStackTraceElement.static StringGets the stack trace for the current thread.static StringCreates a string of a super class'sObject.toString()method and the provided "toString" text.static PrintStreamCreate aPrintStreamfromSystem.errbeing UTF-8 encoded and filtering out ANSI escape codes in case the underlying terminal does not support the such.static PrintStreamCreate aPrintStreamfromSystem.outbeing UTF-8 encoded and filtering out ANSI escape codes in case the underlying terminal does not support the such.
-
Field Details
-
NON_EXISTING_VALUE
-
ALIAS_SET
- See Also:
-
ALIAS_GET
- See Also:
-
ALIAS_HAS
- See Also:
-
ALIAS_IS
- See Also:
-
ALIAS_TOSTRING
- See Also:
-
CTRL_C_SIGNAL
- See Also:
-
-
Method Details
-
toLauncherDir
Generates the base path relative to the given class location. Depending on the runtime, the path is truncated till the required path is determined. In case theSystemProperty.LAUNCHER_DIR(e.g. when providing the following argument-Dlauncher.dir=/path/to/launcher/dirwhen invoking your java's executable) is set and in case its value points to a directory, then this directory is returned.- Returns:
- The base path of this application.
-
getMainClass
Returns the main class launching the application.- Returns:
- The main class.
-
addShutdownHook
Registers a new virtual-machine shutdown hook.
In case of running as a native image (GraalVM AOT), then a
Signalhandler for capturing CTRL+C is registered exiting the application regularirly so that shutdown hooks registered withaddShutdownHook(Thread)are also called when inside a native image. Exiting vie CTRL+C then will exit with status code 130 as ofExitCode.CONTROL_C.- Parameters:
hook- An initialized but not startedThreadobject
-
addShutdownHook
Registers a new virtual-machine shutdown hook.
In case of running as a native image (GraalVM AOT), then a
Signalhandler for capturing CTRL+C is registered exiting the application properly so that shutdown hooks registered withaddShutdownHook(Thread)are also called when inside a native image. Exiting vie CTRL+C then will exit with status code 130 as ofExitCode.CONTROL_C.- Parameters:
hook- ARunnableobject (convenience method foraddShutdownHook(Thread)).
-
setJulLoggingHandler
-
setJulLoggingStreams
public static void setJulLoggingStreams(OutputStream aStdStream, OutputStream aErrStream, Level aLevel) Redirects theLoggerconfiguration to the provided streams.- Parameters:
aStdStream- TheOutputStreamto write all unproblematic logs with levels such asLevel.INFOorLevel.CONFIGto.aErrStream- TheOutputStreamto write all problematic logs with levels such asLevel.WARNINGorLevel.SEVEREto.aLevel- The logLevelas of which to log to the provided streams.
-
setJulLoggingLevel
-
toBootstrapStandardOut
Returns the original
PrintStreamfor STDOUT as initialized by the JVM at bootstrapping time (theSystem.outPrintStreammay have got modified by libraries or frameworks).The returned
PrintStream'sPrintStream.close()method is disabled for preventing the STD OUT stream to be closed upon an auto closetry( ... ) { ... }statement!- Returns:
- The real
PrintStreamas initially set.
-
toBootstrapStandardError
Returns the original
PrintStreamfor STDERR as initialized by the JVM at bootstrapping time (theSystem.errPrintStreammay have got modified by libraries or frameworks in the meanwhile).The returned
PrintStream'sPrintStream.close()method is disabled for preventing the STD OUT stream to be closed upon an auto closetry( ... ) { ... }statement!- Returns:
- The real
PrintStreamas initially set.
-
toBootstrapStandardIn
Returns the original
InputStreamfor STDIN as initialized by the JVM at bootstrapping time (theSystem.inInputStreammay have got modified by libraries or frameworks in the meanwhile).The returned
InputStream'sInputStream.close()method is disabled for preventing the STD OUT stream to be closed upon an auto closetry( ... ) { ... }statement!- Returns:
- The real
InputStreamas initially set.
-
toSystemOut
Create a
PrintStreamfromSystem.outbeing UTF-8 encoded and filtering out ANSI escape codes in case the underlying terminal does not support the such.The returned
PrintStream'sPrintStream.close()method is disabled for preventing the STD OUT stream to be closed upon an auto closetry( ... ) { ... }statement!- Returns:
- The
System.outPrintStreamaccordingly wrapped.
-
toSystemErr
Create a
PrintStreamfromSystem.errbeing UTF-8 encoded and filtering out ANSI escape codes in case the underlying terminal does not support the such.The returned
PrintStream'sPrintStream.close()method is disabled for preventing the STD OUT stream to be closed upon an auto closetry( ... ) { ... }statement!- Returns:
- The
System.errPrintStreamaccordingly wrapped.
-
isNativeImage
public static boolean isNativeImage()Determines whether we are inside an executing native image, e.g. theSystemProperty.NATIVE_IMAGE_CODE's value evaluates toNativeImageCode.RUNTIME's value.- Returns:
- True in case we are inside an executing native image.
-
isUnderTest
public static boolean isUnderTest()Determines whether this code is executed from inside a unit test or not.- Returns:
- True in case if executed from within a unit test.
-
toStackTrace
Gets the stack trace for the current thread.- Returns:
- The stack trace from the current thread.
-
getCallerStackTraceElement
Returns theStackTraceElementbelonging to the direct caller of this method. When you use this method in your code, you get the stack trace element of your method (invoking this method).- Returns:
- The stack element of the direct caller of this method.
-
getCallerStackTraceElement
Returns theStackTraceElementbelonging to the caller of the callee. Best you do not use theObject.getClass()method, instead use YourClass.class as as of inheritance,Object.getClass()returns the wrong type not being the actual callee!- Parameters:
aCallee- The callee class which wants to find out who called it.- Returns:
- The stack element of the caller of the callee or null if the callee is not present or if there is no caller of the given callee in the current stack trace.
-
getCallerStackTraceElement
Returns theStackTraceElementbelonging to the caller of the callee. Best you do not use theObject.getClass()method, instead use YourClass.class as as of inheritance,Object.getClass()returns the wrong type not being the actual callee!- Parameters:
aCallee- The calleeStackTraceElementwhich wants to find out who called it.- Returns:
- The stack element of the caller of the callee or null if the callee is not present or if there is no caller of the given callee in the current stack trace.
-
getCallerStackTraceElement
Same asgetCallerStackTraceElement(Class)with the difference that the passed callees are tried out one after the other until the first caller determined for a callee is returned.- Parameters:
aCallees- the callees- Returns:
- the caller
StackTraceElement
-
getCallerStackTraceElement
Same asgetCallerStackTraceElement(StackTraceElement)with the difference that the passed callees are tried out one after the other until the first caller determined for a callee is returned.- Parameters:
aCallees- the callees- Returns:
- the caller
StackTraceElement
-
getCallerStackTraceElement
Same asgetCallerStackTraceElement(String)with the difference that the passed callees are tried out one after the other until the first caller determined for a callee is returned.- Parameters:
aCalleeClassNames- the callee class names- Returns:
- the caller
StackTraceElement
-
getCallerStackTraceElement
Returns theStackTraceElementbelonging to the caller of the callee. The callee can also be a package namespace where the matchee's must begin with the given package namespace.- Parameters:
aCalleeClassName- The callee class name or package namespace which wants to find out who called it.- Returns:
- The stack element of the caller of the callee or null if the callee is not present or if there is no caller of the given callee in the current stack trace.
-
toHeurisitcCallerStackTraceElement
Returns the best matchingStackTraceElementbelonging to the caller of the callee. The "best matching"StackTraceElementis considered to be the one not belonging to any "internal" API in a package namespace such as "com.sun.*", "java.*" or "javax.*". The callee can also be a package namespace where the matchee's must begin with the given package namespace.- Parameters:
aCalleeClassName- The callee class name or package namespace which wants to find out who called it.- Returns:
- The stack element of the caller of the callee or null if the callee is not present or if there is no caller of the given callee in the current stack trace.
-
toHeurisitcCallerStackTraceElement
Returns the best matchingStackTraceElementbelonging to the caller of the callee.The "best matching"StackTraceElementis considered to be the one not belonging to any "internal" API in a package namespace such as "com.sun.*", "java.*" or "javax.*".- Parameters:
aCallee- The calleeStackTraceElementwhich wants to find out who called it.- Returns:
- The stack element of the caller of the callee or null if the callee is not present or if there is no caller of the given callee in the current stack trace.
-
toHeurisitcCallerStackTraceElement
Returns the best matchingStackTraceElementbelonging to the caller of the callee.The "best matching"StackTraceElementis considered to be the one not belonging to any "internal" API in a package namespace such as "com.sun.*", "java.*" or "javax.*".- Parameters:
aCallee- The calleeStackTraceElementwhich wants to find out who called it.- Returns:
- The stack element of the caller of the callee or null if the callee is not present or if there is no caller of the given callee in the current stack trace.
-
toHeurisitcCallerStackTraceElement
Returns the best matchingStackTraceElementbelonging to the caller of one of the callees (in the order passed to the method).The "best matching"StackTraceElementis considered to be the one not belonging to any "internal" API in a package namespace such as "com.sun.*", "java.*" or "javax.*". The callees can also be a package namespace where the matchee's must begin with the given package namespace.- Parameters:
aCallees- The callees names for which to find out who called it.- Returns:
- The stack element of the caller of the callee or null if the callee is not present or if there is no caller of the given callee in the current stack trace.
-
toHeurisitcCallerStackTraceElement
Returns the best matchingStackTraceElementbelonging to the caller of one of the callees (in the order passed to the method).The "best matching"StackTraceElementis considered to be the one not belonging to any "internal" API in a package namespace such as "com.sun.*", "java.*" or "javax.*".- Parameters:
aCallees- The calleesStackTraceElementinstances for which to find out who called it.- Returns:
- The stack element of the caller of the callee or null if the callee is not present or if there is no caller of the given callee in the current stack trace.
-
toHeurisitcCallerStackTraceElement
Returns the best matchingStackTraceElementbelonging to the caller of one of the callees (in the order passed to the method).The "best matching"StackTraceElementis considered to be the one not belonging to any "internal" API in a package namespace such as "com.sun.*", "java.*" or "javax.*".- Parameters:
aCallees- The calleesClassinstances for which to find out who called it.- Returns:
- The stack element of the caller of the callee or null if the callee is not present or if there is no caller of the given callee in the current stack trace.
-
getCallerType
-
getCallerType
-
getCallerType
Same asgetCallerType(Class)with the difference that the passed callees are tried out one after the other until the first caller determined for a callee is returned.- Parameters:
aCallees- the callees- Returns:
- the caller type
-
getCallerType
-
getCallerType
Same asgetCallerType(String)with the difference that the passed callees are tried out one after the other until the first caller determined for a callee is returned.- Parameters:
aCallees- the callees- Returns:
- the caller type
-
getCallerType
Returns the type of the (Class) belonging to the caller of the callee. The callee can also be a package namespace where the matchee's must begin with the given package namespace.- Parameters:
aCallee- The callee class which wants to find out who called it.- Returns:
- The type (
Class) of the caller of the caller of this method.
-
getCallerType
Same asgetCallerType(StackTraceElement)with the difference that the passed callees are tried out one after the other until the first caller determined for a callee is returned.- Parameters:
aCallees- the callees- Returns:
- the caller type
-
toClass
Retrieves theClasstype to which theStackTraceElementbelongs.- Parameters:
aStackTraceElement- TheStackTraceElementfor which to get the accordingClass.- Returns:
- The type (
Class) of the accordingStackTraceElement.
-
toMethodName
Retrieves the method name from aStackTraceElement.- Parameters:
aStackTraceElement- TheStackTraceElementfrom which to retrieve the method name.- Returns:
- The method name or null in case the
StackTraceElementwas null.
-
toClassName
Returns the class name part from aStackTraceElement. Retrieves the fully qualified class name from aStackTraceElement.- Parameters:
aStackTraceElement- TheStackTraceElementfrom which to retrieve the class name.- Returns:
- The class name without the package declaration or null in case
the
StackTraceElementwas null.
-
toFullyQualifiedClassName
Retrieves the fully qualified class name from aStackTraceElement.- Parameters:
aStackTraceElement- TheStackTraceElementfrom which to retrieve the fully qualified class name.- Returns:
- The fully qualified class name or null in case the stack trace element was null.
-
toFullyQualifiedMethodName
Retrieves the fully qualified method name from aStackTraceElement. This adds the method name to the fully qualified path name separated by a hash "#".- Parameters:
aStackTraceElement- TheStackTraceElementfrom which to retrieve the fully qualified method name.- Returns:
- The fully qualified method name or null in case the stack trace element was null.
-
toFullyQualifiedClassName
Retrieves the fully qualified method name of the caller of this method. This adds the method name to the caller's fully qualified path name separated by a hash "#".- Returns:
- The fully qualified method name.
-
toFullyQualifiedMethodName
Retrieves the fully qualified method name of the caller of this method. This adds the method name to the caller's fully qualified path name separated by a hash "#".- Returns:
- The fully qualified method name.
-
toMethodName
Retrieves the fully qualified method name of the caller of this method. This adds the method name to the caller's fully qualified path name separated by a hash "#".- Returns:
- The fully qualified method name.
-
toClassName
Retrieves the class name of the caller of this method without the fully qualified package name part.- Returns:
- The class name.
-
toFullyQualifiedPackageName
Retrieves the fully qualified package name of the caller of this method without the class name part.- Returns:
- The fully qualified package name.
-
toFullyQualifiedPackageName
Retrieves the fully qualified package name from aStackTraceElement.- Parameters:
aStackTraceElement- TheStackTraceElementfrom which to retrieve the fully qualified package name.- Returns:
- The fully qualified package name.
-
toClassName
Returns the class name part from a fully qualified class name (which has the fully qualified package name as part of its name).- Parameters:
aFullyQualifiedClassName- The fully qualified class name.- Returns:
- The class name without the package declaration.
-
toFullyQualifiedPackageName
Returns the fully qualified package name part from a fully qualified class name (which has the fully qualified package name as part of its name).- Parameters:
aFullyQualifiedClassName- The fully qualified class name.- Returns:
- The fully qualified package name without the class name.
-
toClone
ACloneableobject cannot directly be cloned by casting it to beCloneable:-( Thereforee this method does the job. Citation From Josh Bloch's Effective Java: "TheCloneableinterface was intended as a mixin interface for objects to advertise that they permit cloning. Unfortunately it fails to serve this purpose ... This is a highly atypical use of interfaces and not one to be emulated ... In order for implementing the interface to have any effect on a class, it and all of its superclasses must obey a fairly complex, unenforceable and largely undocumented protocol"- Type Parameters:
T- the generic type- Parameters:
aObj- The object to be cloned.- Returns:
- The cloned object.
- Throws:
CloneNotSupportedException- in case the object cannot be cloned.- See Also:
-
toString
Creates a string of a super class'sObject.toString()method and the provided "toString" text.- Parameters:
aToString- The provided "toString" text.aSuperToString- A super class'sObject.toString()method'sString.- Returns:
- The "concatenated" and formatted new
Stringto be returned by an implementing class'sObject.toString()method.
-
annotations
-
annotations
-
annotations
-
annotations
-
findAnnotation
Seeks for anAnnotationof the given type annotating a providedClass, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aClass- theClasswhich's annotations to crawl.- Returns:
- the
Annotationannotating the givenClassor null if none was found
-
findAnnotation
Seeks for anAnnotationof the given type annotating a providedField, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aField- theFieldwhich's annotations to crawl.- Returns:
- the
Annotationannotating the givenFieldor null if none was found
-
findAnnotation
Seeks for anAnnotationof the given type annotating a providedMethod, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aMethod- theMethodwhich's annotations to crawl.- Returns:
- the
Annotationannotating the givenMethodor null if none was found
-
findAnnotation
Seeks for anAnnotationof the given type annotating a providedObject, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aObj- theObjectwhich's annotations to crawl.- Returns:
- the
Annotationannotating the givenObjector null if none was found
-
hasAnnotation
Tests if anAnnotationof the given type annotates a providedClass, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aClass- theClasswhich's annotations to crawl.- Returns:
- True in case the
Annotationannotates the givenClass.
-
hasAnnotation
Tests if anAnnotationof the given type annotates a providedField, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aField- theFieldwhich's annotations to crawl.- Returns:
- True in case the
Annotationannotates the givenField.
-
hasAnnotation
Tests if anAnnotationof the given type annotates a providedMethod, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aMethod- theMethodwhich's annotations to crawl.- Returns:
- True in case the
Annotationannotates the givenMethod.
-
hasAnnotation
Tests if anAnnotationof the given type annotates a providedObject, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aObj- theObjectwhich's annotations to crawl.- Returns:
- True in case the
Annotationannotates the givenObject.
-
hasGetterAttribute
public static boolean hasGetterAttribute(Object anObject, String anAttributeName, Class<?> aReturnType) This method tests whether the given java beans getter attribute is found for the given object.- Parameters:
anObject- The object which is to be tested.anAttributeName- The attribute name.aReturnType- The expected (sub-) aClass of the return value- Returns:
- True if the object has a method with the given java beans name which returns the given (super-) aClass.
-
hasSetterAttribute
public static boolean hasSetterAttribute(Object anObject, String anAttributeName, Class<?> anAttributeType) This method tests whether the given java beans setter attribute is found for the given object.- Parameters:
anObject- The object which is to be tested.anAttributeName- The attribute name.anAttributeType- The expected (sub-) aClass of the attribute- Returns:
- True if the object has a method with the given java beans name which can be called with an argument of the given aClass.
-
setAttribute
public static void setAttribute(Object anObject, org.refcodes.struct.Attribute anAttributeValueStruct) throws NoSuchMethodException This method sets a java beans attribute for the given object.- Parameters:
anObject- The object which's attribute is to be set.anAttributeValueStruct- The name-to-value struct for the attrubute to be set.- Throws:
NoSuchMethodException- Description of the Exception
-
setAttribute
public static void setAttribute(Object anObject, String anAttributeName, Object anAttributeValue) throws NoSuchMethodException This method sets a java beans attribute for the given object. The corresponding java beans method must begin with a 'set', the following letter must be in upper case and it must only take one argument being of the same (or super-) aClass as the attribute's aClass.- Parameters:
anObject- The object which's java beans method is to be called.anAttributeName- The attribute name of the java beans method.anAttributeValue- The value of the attribute to be set.- Throws:
NoSuchMethodException- Description of the Exception
-
containsDir
Contains dir.- Parameters:
aDir- the diraDirs- the dirs- Returns:
- true, if successful
-
toBeanAttributes
This method uses reflection on order to analyze a given object. The java beans attributes and their values are retrieved and returned in an array of name-to-value pairs.- Parameters:
anObject- The object to be analyzed.- Returns:
- An array of objects containing the java beans name-to-value pairs.
-
probeTillNoneLoggerElement
Try to skip any logging framework's factory or whatsoeverStackTraceElementinstances.- Parameters:
aCallees- The callees for which to skip the unwantedStackTraceElementinstances.- Returns:
- A non logging framework
StackTraceElementor the one passed.
-