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