1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | package Torello.JavaDoc.Messager; import static Torello.Java.C.BYELLOW; import static Torello.Java.C.BCYAN; import static Torello.Java.C.RESET; import Torello.HTML.TagNode; // The only purposes of this class is to provide some very basic and simple "Helpers" to all of the // Error-Message invocations that the JDU makes. // // There is nothing too difficult about typing a File-Name, and making sure not to leave off the // leading four-spaces of indentation, or even typing out the words "BYELLOW" and "RESET". // However, using a method to do this GUARANTEES that I ALWAYS: // use the color YELLOW. // add exacty four-spaces of indentation // start on a new-line, and end with a '\n' newline // always use brackets to surround the file-name. // // This is the entire value of this cute little "Helper Class". // // There will be an "increasing amount" of consistency between error messages that are printed // from different parts, sections and areas of the JDU Upgrader code / logic. // // No more no less! public class MsgPrintTools { // Any and all File-Names that are printed. These are on their own line // These are supposed to be "complete" file names // // NOTE: The '\n' **IS NOT** included here, because it makes the code where this is actually // invoked look nicer. Seeing the line before this method-invocation ending with a '\n' // is easier to read over there, rather than as the first character - in the string that // is returned, directy below public static String fileName(final String fName) { return " [" + BYELLOW + fName + RESET + "]\n"; } public static String annotationAsStr(final String annotationAsStr) { return " [" + BCYAN + annotationAsStr + RESET + "]\n"; } // These are **NOT** on their own line. These are supposed to be simple (not full) // file-names or directory-names (partial directory names, for example) public static String fileOrDirNameShort(final String fileOrDirName) { return "'" + BYELLOW + fileOrDirName + RESET + "'"; } // <EMBED>-Tag DATA-FILE-ID Attributes public static String embedTagID(final String eTagID) { return "For <EMBED>-Tag File-ID [" + BCYAN + eTagID + RESET + "]:\n"; } // **COMPLETE** <EMBED>-Tags (which aren't printed that often, but a few times) public static String embedTag(final TagNode tn) { return "<EMBED>-Tag Found:\n" + " [" + BCYAN + tn.str + RESET + "]\n"; } // Any and all File-Names that are printed public static String className(final Class<?> clazz) { return " [" + BCYAN + clazz.getCanonicalName() + RESET + "]\n"; } // When an error occurs that should have been caught by the 'javac' Annotation-Processor // For instance, multiplw instances of an Annotation-Element should be caught during // compile time, literallly, by 'javac'. However, a user has the right to turn off annotation // processing, or might even invoke the upgrader on a '.java' file which hasn't been processed // // I don't worry about these types of errors very often in my code, but in cases where such an // error check is being performed - it might be a good idea to include this type of messahr public static String annotationProcessingError() { return '\n' + "This is a class of error which should be caught by the Standard Java 'javac' " + "Compiler. Has Annotation Processing been disabled by your build?"; } } |