001package Torello.JavaDoc.Messager;
002
003import static Torello.Java.C.BYELLOW;
004import static Torello.Java.C.BCYAN;
005import static Torello.Java.C.RESET;
006
007import Torello.HTML.TagNode;
008
009// The only purposes of this class is to provide some very basic and simple "Helpers" to all of the
010// Error-Message invocations that the JDU makes.
011// 
012// There is nothing too difficult about typing a File-Name, and making sure not to leave off the
013// leading four-spaces of indentation, or even typing out the words "BYELLOW" and "RESET".
014// However, using a method to do this GUARANTEES that I ALWAYS:
015//      use the color YELLOW.
016//      add exacty four-spaces of indentation
017//      start on a new-line, and end with a '\n' newline
018//      always use brackets to surround the file-name.
019// 
020// This is the entire value of this cute little "Helper Class".
021// 
022// There will be an "increasing amount" of consistency between error messages that are printed
023// from different parts, sections and areas of the JDU Upgrader code / logic.
024//  
025// No more no less!
026
027public class MsgPrintTools
028{
029    // Any and all File-Names that are printed.  These are on their own line
030    // These are supposed to be "complete" file names
031    // 
032    // NOTE: The '\n' **IS NOT** included here, because it makes the code where this is actually
033    //       invoked look nicer.  Seeing the line before this method-invocation ending with a '\n'
034    //       is easier to read over there, rather than as the first character - in the string that
035    //       is returned, directy below
036
037    public static String fileName(final String fName)
038    { return "    [" + BYELLOW + fName + RESET + "]\n"; }
039
040    public static String annotationAsStr(final String annotationAsStr)
041    { return "    [" + BCYAN + annotationAsStr + RESET + "]\n"; }
042
043
044    // These are **NOT** on their own line.  These are supposed to be simple (not full)
045    // file-names or directory-names (partial directory names, for example)
046
047    public static String fileOrDirNameShort(final String fileOrDirName)
048    { return "'" + BYELLOW + fileOrDirName + RESET + "'"; }
049
050    // <EMBED>-Tag DATA-FILE-ID Attributes
051    public static String embedTagID(final String eTagID)
052    { return "For <EMBED>-Tag File-ID [" + BCYAN + eTagID + RESET + "]:\n"; }
053
054    // **COMPLETE** <EMBED>-Tags (which aren't printed that often, but a few times)
055    public static String embedTag(final TagNode tn)
056    {
057        return "<EMBED>-Tag Found:\n" +
058            "    [" + BCYAN + tn.str + RESET + "]\n";
059    }
060
061    // Any and all File-Names that are printed
062    public static String className(final Class<?> clazz)
063    { return "    [" + BCYAN + clazz.getCanonicalName() + RESET + "]\n"; }
064
065
066    // When an error occurs that should have been caught by the 'javac' Annotation-Processor
067    // For instance, multiplw instances of an Annotation-Element should be caught during
068    // compile time, literallly, by 'javac'.  However, a user has the right to turn off annotation
069    // processing, or might even invoke the upgrader on a '.java' file which hasn't been processed
070    // 
071    // I don't worry about these types of errors very often in my code, but in cases where such an
072    // error check is being performed - it might be a good idea to include this type of messahr
073
074    public static String annotationProcessingError()
075    {
076        return
077            '\n' +
078            "This is a class of error which should be caught by the Standard Java 'javac' "  +
079            "Compiler.  Has Annotation Processing been disabled by your build?";
080    }
081}