private static Object formatObject ( Object object ) { if ( object instanceof Class ) { return formatArg ( ( Class < ? > ) object ) ; } else if ( object instanceof Key ) { return formatArg ( ( Key < ? > ) object ) ; } else if ( object instanceof List ) { List < ? > list = ( List < ? > ) object ; // Empirically check if this is a List<Dependency>. boolean allDependencies = true ; for ( Object entry : list ) { if ( ! ( entry instanceof Dependency ) ) { allDependencies = false ; break ; } } if ( allDependencies ) { return formatArg ( ( List < Dependency > ) list ) ; } else { return object ; } } else { return object ; } }
Pretty - print a single object .