1 package org.tigris.scarab.util.build.l10nchecker; 2 3 import java.text.MessageFormat ; 4 5 50 51 54 public abstract class L10nIssue 55 { 56 57 public final static int MESSAGE_IGNORE = -1; 58 59 60 public final static int MESSAGE_INFO = 0; 61 62 63 public final static int MESSAGE_ERROR = 1; 64 65 66 public final static int MESSAGE_WARNING = 2; 67 68 73 public String formatMessage () 74 { 75 try 76 { 77 String out = MessageFormat.format(getMessageTemplate(), getParameters());; 78 return out; 79 } 80 catch (IllegalArgumentException ex_iae) 81 { 82 System.err.println("Error processing " + getMessageTemplate() + ": " + ex_iae.getLocalizedMessage()); 83 } 84 return null; 85 } 86 87 93 public final boolean isError() 94 { 95 return MESSAGE_ERROR == getMessageType(); 96 } 97 98 104 public final boolean isWarning() 105 { 106 return MESSAGE_WARNING == getMessageType(); 107 } 108 109 115 public final boolean isInfo() 116 { 117 return MESSAGE_INFO == getMessageType(); 118 } 119 120 125 abstract public String getMessageTemplate(); 126 127 133 abstract public Object [] getParameters(); 134 135 142 public final int getMessageType() 143 { 144 return L10nIssueTemplates.getMessageType(this.getClass()); 145 } 146 147 152 public final void setMessageType(int messageType) 153 { 154 L10nIssueTemplates.setMessageType(this.getClass(), messageType); 155 } 156 } 157 | Popular Tags |