net.sourceforge.domian.util
Class InstrumentationUtils

java.lang.Object
  extended by net.sourceforge.domian.util.InstrumentationUtils

public class InstrumentationUtils
extends java.lang.Object

Some convenient instrumentation methods and constants.

Since:
0.4
Author:
Eirik Torske

Field Summary
static java.lang.String DEBUG_LEVEL_INDENTATION
           
static java.lang.String DOTS
           
static java.lang.String NOT_APPLICABLE
           
static java.lang.String NOT_SUPPORTED
           
static java.lang.String NOT_YET_SUPPORTED
           
static java.lang.String REDEFINED
           
static java.lang.String REDEFINED_ELSEWHERE
           
static java.lang.String SKIPPED
           
static java.lang.String TEMPORARILY_ISOLATED
           
static java.lang.String TEMPORARY
           
static java.lang.String TODO
           
static java.lang.String TRACE_LEVEL_INDENTATION
           
 
Constructor Summary
InstrumentationUtils()
           
 
Method Summary
static java.lang.String buildDebugLogLevelIterationMessage(int iterationNumber, java.lang.Object instance, java.lang.String methodName)
           
static java.lang.String buildMemoryConsumptionMessage()
           
static java.lang.String buildMessageWithStackTrace(java.lang.String message, java.lang.Integer numberOfStackTraceLines, int skipLines)
          Builds a message containing a trailing stack trace.
static java.lang.String buildMessageWithStackTrace(java.lang.Throwable throwable, java.lang.String message, java.lang.Integer numberOfStackTraceLines, int skipLines)
          Builds a message containing a trailing stack trace.
static java.lang.String buildSimpleClassMethodString(java.lang.Object instance, java.lang.String methodName)
           
static java.lang.String buildTestingOfMethodString(java.lang.Object testTarget, java.lang.String methodName)
          testTarget parameter to be used wherever test methods are inherited.
static java.lang.String buildTestingOfMethodString(java.lang.Object instance, java.lang.String methodName, java.lang.String deviation)
          testTarget parameter to be used wherever test methods are inherited.
static java.lang.String buildTestingOfMethodString(java.lang.String methodName)
           
static java.lang.String buildThreadNumberAndMessage(java.lang.Object instance, java.lang.String methodName, java.lang.String message)
           
static java.lang.String buildThreadNumberAndMessage(java.lang.String message)
           
static java.lang.String getStackTrace(java.lang.Integer numberOfStackTraceLines, java.lang.Integer skipLines)
           
static java.lang.String getStackTrace(java.lang.Throwable throwable, java.lang.Integer numberOfStackTraceLines, java.lang.Integer skipLines)
           
static java.lang.String prettyPrintLargeNumber(long bigNumber)
          US-style pretty-printing of large numbers, adding a comma for every thousand.
static void printPartitionRepository(PartitionRepository repo, java.io.PrintStream printStream)
          Instrumentation of partition repo structure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOTS

public static final java.lang.String DOTS
See Also:
Constant Field Values

NOT_SUPPORTED

public static final java.lang.String NOT_SUPPORTED
See Also:
Constant Field Values

NOT_YET_SUPPORTED

public static final java.lang.String NOT_YET_SUPPORTED
See Also:
Constant Field Values

REDEFINED_ELSEWHERE

public static final java.lang.String REDEFINED_ELSEWHERE
See Also:
Constant Field Values

REDEFINED

public static final java.lang.String REDEFINED
See Also:
Constant Field Values

NOT_APPLICABLE

public static final java.lang.String NOT_APPLICABLE
See Also:
Constant Field Values

SKIPPED

public static final java.lang.String SKIPPED
See Also:
Constant Field Values

TODO

public static final java.lang.String TODO
See Also:
Constant Field Values

TEMPORARILY_ISOLATED

public static final java.lang.String TEMPORARILY_ISOLATED
See Also:
Constant Field Values

TEMPORARY

public static final java.lang.String TEMPORARY
See Also:
Constant Field Values

DEBUG_LEVEL_INDENTATION

public static final java.lang.String DEBUG_LEVEL_INDENTATION

TRACE_LEVEL_INDENTATION

public static final java.lang.String TRACE_LEVEL_INDENTATION
Constructor Detail

InstrumentationUtils

public InstrumentationUtils()
Method Detail

buildTestingOfMethodString

public static java.lang.String buildTestingOfMethodString(java.lang.String methodName)

buildTestingOfMethodString

public static java.lang.String buildTestingOfMethodString(java.lang.Object testTarget,
                                                          java.lang.String methodName)
testTarget parameter to be used wherever test methods are inherited.


buildTestingOfMethodString

public static java.lang.String buildTestingOfMethodString(java.lang.Object instance,
                                                          java.lang.String methodName,
                                                          java.lang.String deviation)
testTarget parameter to be used wherever test methods are inherited.


buildSimpleClassMethodString

public static java.lang.String buildSimpleClassMethodString(java.lang.Object instance,
                                                            java.lang.String methodName)

buildDebugLogLevelIterationMessage

public static java.lang.String buildDebugLogLevelIterationMessage(int iterationNumber,
                                                                  java.lang.Object instance,
                                                                  java.lang.String methodName)

buildThreadNumberAndMessage

public static java.lang.String buildThreadNumberAndMessage(java.lang.String message)

buildThreadNumberAndMessage

public static java.lang.String buildThreadNumberAndMessage(java.lang.Object instance,
                                                           java.lang.String methodName,
                                                           java.lang.String message)

buildMemoryConsumptionMessage

public static java.lang.String buildMemoryConsumptionMessage()
Returns:
a string with format [mem: <used memory in MB>/<free memory in MB>]

getStackTrace

public static java.lang.String getStackTrace(java.lang.Integer numberOfStackTraceLines,
                                             java.lang.Integer skipLines)
Parameters:
numberOfStackTraceLines - the number of stack trace lines wanted
skipLines - the number of stack trace lines to skip, counting from the top
Returns:
indented stack trace lines generated by the JVM

getStackTrace

public static java.lang.String getStackTrace(java.lang.Throwable throwable,
                                             java.lang.Integer numberOfStackTraceLines,
                                             java.lang.Integer skipLines)
Parameters:
throwable - the thrown exception to harvest stacktrace from
numberOfStackTraceLines - the number of stack trace lines wanted
skipLines - the number of stack trace lines to skip, counting from the top
Returns:
indented stack trace lines generated by the JVM

buildMessageWithStackTrace

public static java.lang.String buildMessageWithStackTrace(java.lang.String message,
                                                          java.lang.Integer numberOfStackTraceLines,
                                                          int skipLines)
Builds a message containing a trailing stack trace.

Parameters:
message - message to print to System.err
numberOfStackTraceLines - the number of stack trace lines wanted
skipLines - the number of stack trace lines to skip, counting from the top
Returns:
the constructed message

buildMessageWithStackTrace

public static java.lang.String buildMessageWithStackTrace(java.lang.Throwable throwable,
                                                          java.lang.String message,
                                                          java.lang.Integer numberOfStackTraceLines,
                                                          int skipLines)
Builds a message containing a trailing stack trace.

Parameters:
throwable - the thrown exception to harvest stacktrace from
message - message to print to System.err
numberOfStackTraceLines - the number of stack trace lines wanted
skipLines - the number of stack trace lines to skip, counting from the top
Returns:
the constructed message

prettyPrintLargeNumber

public static java.lang.String prettyPrintLargeNumber(long bigNumber)
US-style pretty-printing of large numbers, adding a comma for every thousand.


printPartitionRepository

public static void printPartitionRepository(PartitionRepository repo,
                                            java.io.PrintStream printStream)
Instrumentation of partition repo structure.



Copyright © 2006-2010. All Rights Reserved.