package com.marcozanon.macaco;
+import com.marcozanon.macaco.text.MText;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.io.IOException;
/* Resources */
public static byte[] getCoreResource(String resource) throws IOException {
- if ((null == resource) || ("".equals(resource))) {
+ if (MText.isBlank(resource)) {
throw new IllegalArgumentException("Invalid 'resource': null or empty.");
}
// modified from http://articles.techrepublic.com.com/5100-10878_11-1046714.html
import com.marcozanon.macaco.MInformation;
import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
/* Strings management */
public void parseFile(String file) throws MFileParsingConfigurationException {
- if ((null == file) || ("".equals(file))) {
+ if (MText.isBlank(file)) {
throw new IllegalArgumentException("Invalid 'file': null or empty.");
}
//
break;
}
line = line.trim();
- if ((line.startsWith("#")) || (line.startsWith(";")) || ("".equals(line))) {
+ if ((line.startsWith("#")) || (line.startsWith(";")) || (MText.isEmpty(line))) {
continue;
}
else {
}
public String getValue(String key) throws MValueNotFoundConfigurationException {
- if ((null == key) || ("".equals(key))) {
+ if (MText.isBlank(key)) {
throw new IllegalArgumentException("Invalid 'key': null or empty.");
}
//
/* Response content */
protected void setResponseContentType(String responseContentType) {
- if ((null == responseContentType) || ("".equals(responseContentType))) {
+ if (MText.isBlank(responseContentType)) {
throw new IllegalArgumentException("Invalid 'responseContentType': null or empty.");
}
//
}
protected void addPlainTextResponseContent(String responseContent) throws MResponseWebException {
- if ((null == responseContent) || ("".equals(responseContent))) {
+ if (MText.isBlank(responseContent)) {
throw new IllegalArgumentException("Invalid 'responseContent': null or empty.");
}
//
}
protected void setXhtmlResponseContent(String responseContent) throws MResponseWebException {
- if ((null == responseContent) || ("".equals(responseContent))) {
+ if (MText.isBlank(responseContent)) {
throw new IllegalArgumentException("Invalid 'responseContent': null or empty.");
}
//
}
public void addNotificationAreaMessage(boolean error, String message, boolean framedOutput) throws MResponseWebException {
- if ((null == message) || ("".equals(message))) {
+ if (MText.isBlank(message)) {
throw new IllegalArgumentException("Invalid 'message': null or empty.");
}
//
import com.marcozanon.macaco.json.MJsonString;
import com.marcozanon.macaco.logging.MLogFilter;
import com.marcozanon.macaco.logging.MLoggingException;
+import com.marcozanon.macaco.text.MText;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import javax.servlet.http.HttpServletRequest;
/* Responses */
protected void returnStandardResponse(HttpServletResponse response, String contentType, byte[] content, boolean ajaxMode) throws IOException {
- if ((null == contentType) || ("".equals(contentType))) {
+ if (MText.isBlank(contentType)) {
contentType = MInformation.HttpContentType.PLAIN.toString();
}
// prepare response content
if (null == response) {
throw new IllegalArgumentException("Invalid 'response': null.");
}
- if ((null == contentType) || ("".equals(contentType))) {
+ if (MText.isBlank(contentType)) {
throw new IllegalArgumentException("Invalid 'contentType': null or empty.");
}
if (null == content) {
/* Redirection */
public void redirect(String url) throws MResponseWebException {
- if ((null == url) || ("".equals(url))) {
+ if (MText.isBlank(url)) {
throw new IllegalArgumentException("Invalid 'url': null or empty.");
}
//
}
else {
for (String k: items.keySet()) {
- if ((null == k) || ("".equals(k))) {
+ if (MText.isBlank(k)) {
throw new IllegalArgumentException("Invalid 'items': item key null or empty.");
}
else if (null == items.get(k)) {
if (null == selectedItemKey) {
throw new IllegalArgumentException("Invalid 'selectedItemKey': null.");
}
- else if ((!"".equals(selectedItemKey)) && (!this.getItemsReference().containsKey(selectedItemKey))) {
+ else if ((!MText.isEmpty(selectedItemKey)) && (!this.getItemsReference().containsKey(selectedItemKey))) {
throw new IllegalArgumentException(String.format("Invalid 'selectedItemKey': %s: not available.", selectedItemKey));
}
//
public int getSelectedItemIndex() {
String selectedItemKey = this.getSelectedItemKey();
int selectedItemIndex = 0;
- if ("".equals(selectedItemKey)) {
+ if (MText.isEmpty(selectedItemKey)) {
return selectedItemIndex;
}
for (String k: this.getItemsReference().keySet()) {
if (null == selectedItemKey) {
throw new MUnexpectedMessageWebException("Invalid message: selected item key parameter not available.");
}
- else if ((!"".equals(selectedItemKey)) && (!this.getItemsReference().keySet().contains(selectedItemKey))) {
+ else if ((!MText.isEmpty(selectedItemKey)) && (!this.getItemsReference().keySet().contains(selectedItemKey))) {
throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: selected item key parameter not recognized.", selectedItemKey));
}
this.onBlur(selectedItemKey);
if (null == selectedItemKey) {
throw new MUnexpectedMessageWebException("Invalid message: selected item key parameter not available.");
}
- else if ((!"".equals(selectedItemKey)) && (!this.getItemsReference().keySet().contains(selectedItemKey))) {
+ else if ((!MText.isEmpty(selectedItemKey)) && (!this.getItemsReference().keySet().contains(selectedItemKey))) {
throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: selected item key parameter not recognized.", selectedItemKey));
}
this.onChange(selectedItemKey);
public Date getDate() throws MFormatConversionException {
Date date = null;
String text = this.getText();
- if (!"".equals(text)) {
+ if (!MText.isEmpty(text)) {
return this.getDateConverterReference().getDateFromString(text);
}
return date;
public void validate() throws MValidationWebException {
String text = this.getText();
- if (!"".equals(text)) {
+ if (!MText.isEmpty(text)) {
try {
MDateConverter dateConverter = this.getDateConverterReference();
this.setText(dateConverter.getStringFromDate(dateConverter.getDateFromString(text)));
package com.marcozanon.macaco.attic.web.ui;
+import com.marcozanon.macaco.text.MText;
+
public abstract class MWebDisplayWidget extends MWebWidget {
public static enum Side {
}
protected void setCustomClasses(String customClasses, boolean refreshMode) {
- if ("".equals(customClasses)) {
+ if (MText.isEmpty(customClasses)) {
throw new IllegalArgumentException("Invalid 'customClasses': empty.");
}
//
/* Display widgets */
protected MWebDisplayWidget getDisplayWidgetReferenceById(String id) throws MDisplayWidgetNotFoundWebException {
- if ((null == id) || ("".equals(id))) {
+ if (MText.isBlank(id)) {
throw new IllegalArgumentException("Invalid 'id': null or empty.");
}
//
package com.marcozanon.macaco.attic.web.ui;
import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
public class MWebFont extends MObject {
if (null == size) {
throw new IllegalArgumentException("Invalid 'size': null.");
}
- if ((null == family) || ("".equals(family))) {
+ if (MText.isBlank(family)) {
throw new IllegalArgumentException("Invalid 'family': null or empty.");
}
if (null == decoration) {
import com.marcozanon.macaco.json.MInvalidValueJsonException;
import com.marcozanon.macaco.json.MJsonObject;
import com.marcozanon.macaco.json.MJsonString;
+import com.marcozanon.macaco.text.MText;
import java.util.LinkedHashMap;
public class MWebMessage extends MObject {
public MWebMessage(String message) throws MMessagingWebException {
super();
//
- if ((null == message) || "".equals(message)) {
+ if (MText.isBlank(message)) {
throw new IllegalArgumentException("Invalid 'message': null or empty.");
}
//
}
try {
String temporaryEvent = ((MJsonString)jsonMessage.getValue("event")).getValue();
- if ("".equals(temporaryEvent)) {
+ if (MText.isEmpty(temporaryEvent)) {
throw new MMessagingWebException("Invalid 'message': event empty.");
}
this.event = temporaryEvent;
public BigDecimal getNumber() throws MFormatConversionException {
BigDecimal number = null;
String text = this.getText();
- if (!"".equals(text)) {
+ if (!MText.isEmpty(text)) {
return this.getNumberConverterReference().getNumberFromString(text);
}
return number;
public void validate() throws MValidationWebException {
String text = this.getText();
- if (!"".equals(text)) {
+ if (!MText.isEmpty(text)) {
try {
MNumberConverter numberConverter = this.getNumberConverterReference();
this.setText(numberConverter.getStringFromNumber(numberConverter.getNumberFromString(text)));
}
else {
for (String columnKey: columnHeaders.keySet()) {
- if ((null == columnKey) || ("".equals(columnKey))) {
+ if (MText.isBlank(columnKey)) {
throw new IllegalArgumentException("Invalid 'columnHeaders': column key null or empty.");
}
else if (null == columnHeaders.get(columnKey)) {
}
}
}
- if ((null == primaryKey) || ("".equals(primaryKey))) {
+ if (MText.isBlank(primaryKey)) {
throw new IllegalArgumentException("Invalid 'primaryKey': null or empty.");
}
//
}
protected void setSortKey(String sortKey, boolean ascendingSortMode, boolean refreshMode) {
- if ("".equals(sortKey)) {
+ if (MText.isEmpty(sortKey)) {
throw new IllegalArgumentException("Invalid 'sortKey': empty.");
}
//
throw new IllegalArgumentException("Invalid 'rows': row null.");
}
for (String columnKey: row.keySet()) {
- if ((null == columnKey) || ("".equals(columnKey))) {
+ if (MText.isBlank(columnKey)) {
throw new IllegalArgumentException("Invalid 'rows': column key null or empty.");
}
}
}
protected void setRowSelectedMode(String primaryKeyValue, boolean selectedMode, boolean refreshMode) {
- if ((null == primaryKeyValue) || ("".equals(primaryKeyValue))) {
+ if (MText.isBlank(primaryKeyValue)) {
throw new IllegalArgumentException("Invalid 'primaryKeyValue': null or empty.");
}
//
}
public boolean getRowSelectedMode(String primaryKeyValue) {
- if ((null == primaryKeyValue) || ("".equals(primaryKeyValue))) {
+ if (MText.isBlank(primaryKeyValue)) {
throw new IllegalArgumentException("Invalid 'primaryKeyValue': null or empty.");
}
//
}
for (String columnKey: columnHeaders.keySet()) {
String onSortFunction = "";
- if (!"".equals(columnHeaders.get(columnKey).getText())) {
+ if (!MText.isEmpty(columnHeaders.get(columnKey).getText())) {
onSortFunction = String.format("javascript: m_messageInterface.fireMessage('%s', 'onSort', {'sortKey': '%s'});", this.getId(), MText.getJavascriptEscapedString(columnKey));
}
content.append(String.format("<th class=\"MWebTableColumnHeaderCell %s\" onclick=\"%s\" id=\"%s\"></th>", customClasses, MText.getXhtmlEscapedString(onSortFunction), columnHeaders.get(columnKey).getId()));
if (null == selectedPage) {
throw new MUnexpectedMessageWebException("Invalid message: selected page parameter not available.");
}
- else if ((!"".equals(selectedPage)) && ((Integer.parseInt(selectedPage) < 1) || (Integer.parseInt(selectedPage) > (int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage())))) {
+ else if ((!MText.isEmpty(selectedPage)) && ((Integer.parseInt(selectedPage) < 1) || (Integer.parseInt(selectedPage) > (int)Math.ceil((float)this.getRowCount() / (float)this.getRowsPerPage())))) {
throw new MUnexpectedMessageWebException(String.format("Invalid message: %s: selected page parameter out of range.", selectedPage));
}
this.onPageSelection(selectedPage);
}
public void onPageSelection(String selectedPage) {
- if ("".equals(selectedPage)) {
+ if (MText.isEmpty(selectedPage)) {
this.setSelectedPage(null);
}
else {
}
protected void setExternalLinkPrefix(String externalLinkPrefix, boolean refreshMode) {
- if ("".equals(externalLinkPrefix)) {
+ if (MText.isEmpty(externalLinkPrefix)) {
throw new IllegalArgumentException("Invalid 'externalLinkPrefix': empty.");
}
//
}
else {
for (String k: items.keySet()) {
- if ((null == k) || ("".equals(k))) {
+ if (MText.isBlank(k)) {
throw new IllegalArgumentException("Invalid 'items': item key null or empty.");
}
else if (null == items.get(k)) {
}
protected void setSelectedItem(String selectedItemKey, boolean refreshMode) {
- if ("".equals(selectedItemKey)) {
+ if (MText.isEmpty(selectedItemKey)) {
throw new IllegalArgumentException("Invalid 'selectedItemKey': empty.");
}
else if ((null != selectedItemKey) && (!this.getItemsReference().containsKey(selectedItemKey))) {
/* Refresh */
protected String getItemContent(String parentItemKey) throws MNoWidgetIdWebException { // code partly taken from http://www.codecodex.com/wiki/Count_the_number_of_occurrences_of_a_specific_character_in_a_string
- if ("".equals(parentItemKey)) {
+ if (MText.isEmpty(parentItemKey)) {
throw new IllegalArgumentException("Invalid 'parentItemKey': empty.");
}
//
}
itemContent.append(String.format("<tr class=\"MWebVerticalMenuRow %s\">", customClasses));
String text = this.getItemsReference().get(itemKey).getText();
- if (!"".equals(text)) {
+ if (!MText.isEmpty(text)) {
String imageSource = this.getItemsReference().get(itemKey).getImageSource();
if (null == imageSource) {
imageSource = String.format("%s/null", this.getApplicationContextReference().getRequestReference().getRequestURL());
//
if ((!this.getAccordionMode()) || (this.getAccordionMode() && (null != this.getSelectedItemKey()) && (this.getSelectedItemKey().startsWith(itemKey)))) {
String childItemContent = this.getItemContent(itemKey);
- if (!"".equals(childItemContent.toString())) {
+ if (!MText.isEmpty(childItemContent.toString())) {
itemContent.append(String.format("<tr class=\"MWebVerticalMenuRow %s\">", customClasses));
itemContent.append(String.format("<td class=\"MWebVerticalMenuImageCell\" />", customClasses));
itemContent.append(String.format("<td class=\"MWebVerticalMenuChildTableCell %s\" id=\"%s\">%s</td>", customClasses, this.getId() + MText.getXhtmlEscapedString(itemKey) + "-childCell", childItemContent));
}
//
StringBuilder content = new StringBuilder("");
- if (!"".equals(itemContent.toString())) {
- if ("".equals(parentItemKey)) {
+ if (!MText.isEmpty(itemContent.toString())) {
+ if (MText.isEmpty(parentItemKey)) {
content.append(String.format("<table class=\"MWebVerticalMenuTable %s\" style=\"display: inline-table;\" id=\"%s\">", customClasses, this.getId()));
}
else {
this.checkPresence();
//
String content = this.getItemContent(null);
- if ("".equals(content)) {
+ if (MText.isEmpty(content)) {
content = String.format("<div id=\"%s\"></div>", this.getId());
}
this.getApplicationContextReference().addPlainTextResponseContent(String.format("if ($('%s')) { $('%s').parentNode.innerHTML = '%s'; }", this.getId(), this.getId(), MText.getJavascriptEscapedString(content)));
if (null == applicationContext) {
throw new IllegalArgumentException("Invalid 'applicationContext': null.");
}
- if ((null == breadcrumb) || ("".equals(breadcrumb))) {
+ if (MText.isBlank(breadcrumb)) {
throw new IllegalArgumentException("Invalid 'breadcrumb': null or empty.");
}
//
}
public MWebDownloader getDownloaderReferenceById(String id) throws MDownloaderNotFoundWebException {
- if ((null == id) || ("".equals(id))) {
+ if (MText.isBlank(id)) {
throw new IllegalArgumentException("Invalid 'id': null or empty.");
}
//
String widgetId = message.getWidgetId();
String event = message.getEvent();
LinkedHashMap<String, String> parameters = message.getParameters();
- if ("".equals(widgetId)) { // no widget id = view
+ if (MText.isEmpty(widgetId)) { // no widget id = view
if ("onRefresh".equals(event)) {
this.onRefresh();
}
package com.marcozanon.macaco.attic.web.ui;
import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
import java.util.LinkedHashMap;
public abstract class MWebWidget extends MObject {
/* Messages */
protected void processMessage(String event, LinkedHashMap<String, String> parameters) throws MUnexpectedMessageWebException {
- if ((null == event) || ("".equals(event))) {
+ if (MText.isBlank(event)) {
throw new IllegalArgumentException("Invalid 'event': null or empty.");
}
if (null == parameters) {
package com.marcozanon.macaco.conversion;
import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
/* Conversion */
protected static void checkDateFormat(String dateFormat) {
- if ((null == dateFormat) || ("".equals(dateFormat))) {
+ if (MText.isBlank(dateFormat)) {
throw new IllegalArgumentException("Invalid 'dateFormat': null or empty.");
}
//
}
protected static Date getDateFromStringByParameters(String x, String inputDateFormat, Locale inputLocale, TimeZone inputTimeZone) throws MFormatConversionException {
- if ((null == x) || ("".equals(x))) {
+ if (MText.isBlank(x)) {
throw new IllegalArgumentException("Invalid 'x': null or empty.");
}
MDateConverter.checkDateFormat(inputDateFormat);
package com.marcozanon.macaco.conversion;
import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
/* Conversion */
protected static void checkNumberFormat(String numberFormat) {
- if ((null == numberFormat) || ("".equals(numberFormat))) {
+ if (MText.isBlank(numberFormat)) {
throw new IllegalArgumentException("Invalid 'numberFormat': null or empty.");
}
//
}
protected static BigDecimal getNumberFromStringByParameters(String x, String inputNumberFormat, Locale inputLocale) throws MFormatConversionException {
- if ((null == x) || ("".equals(x))) {
+ if (MText.isBlank(x)) {
throw new IllegalArgumentException("Invalid 'x': null or empty.");
}
MNumberConverter.checkNumberFormat(inputNumberFormat);
package com.marcozanon.macaco.json;
+import com.marcozanon.macaco.text.MText;
+
public class MJsonBoolean extends MJsonValue {
protected Boolean value = null;
}
public void parseString(String x) throws MInvalidValueJsonException {
- if ((null == x) || ("".equals(x))) {
+ if (MText.isBlank(x)) {
throw new IllegalArgumentException("Invalid 'x': null or empty.");
}
//
package com.marcozanon.macaco.json;
+import com.marcozanon.macaco.text.MText;
+
public class MJsonNull extends MJsonValue {
/* */
}
public void parseString(String x) throws MInvalidValueJsonException {
- if ((null == x) || ("".equals(x))) {
+ if (MText.isBlank(x)) {
throw new IllegalArgumentException("Invalid 'x': null or empty.");
}
//
package com.marcozanon.macaco.json;
+import com.marcozanon.macaco.text.MText;
import java.math.BigDecimal;
public class MJsonNumber extends MJsonValue {
}
public void parseString(String x) throws MInvalidValueJsonException {
- if ((null == x) || ("".equals(x))) {
+ if (MText.isBlank(x)) {
throw new IllegalArgumentException("Invalid 'x': null or empty.");
}
//
package com.marcozanon.macaco.json;
+import com.marcozanon.macaco.text.MText;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
/* Values handlers */
public void setValue(String key, MJsonValue x) {
- if ((null == key) || ("".equals(key))) {
+ if (MText.isBlank(key)) {
throw new IllegalArgumentException("Invalid 'key': null or empty.");
}
if (null == x) {
}
public MJsonValue getValue(String key) {
- if ((null == key) || ("".equals(key))) {
+ if (MText.isBlank(key)) {
throw new IllegalArgumentException("Invalid 'key': null or empty.");
}
//
}
public void removeValue(String key) {
- if ((null == key) || ("".equals(key))) {
+ if (MText.isBlank(key)) {
throw new IllegalArgumentException("Invalid 'key': null or empty.");
}
//
}
public boolean containsKey(String key) {
- if ((null == key) || ("".equals(key))) {
+ if (MText.isBlank(key)) {
throw new IllegalArgumentException("Invalid 'key': null or empty.");
}
//
package com.marcozanon.macaco.json;
+import com.marcozanon.macaco.text.MText;
+
public class MJsonString extends MJsonValue {
protected boolean extendedEscapeMode = false;
}
public void parseString(String x) throws MInvalidValueJsonException {
- if ((null == x) || ("".equals(x))) {
+ if (MText.isBlank(x)) {
throw new IllegalArgumentException("Invalid 'x': null or empty.");
}
//
package com.marcozanon.macaco.logging;
import com.marcozanon.macaco.MInformation;
+import com.marcozanon.macaco.text.MText;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
public MLogPlainTextFile(String file) throws MLoggingException {
super();
//
- if ((null == file) || ("".equals(file))) {
+ if (MText.isBlank(file)) {
throw new IllegalArgumentException("Invalid 'file': null or empty.");
}
//
package com.marcozanon.macaco.sql;
import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public MSqlConnection(String driver, String url, String username, String password) throws MConnectionSqlException {
super();
//
- if ((null == driver) || ("".equals(driver))) {
+ if (MText.isBlank(driver)) {
throw new IllegalArgumentException("Invalid 'driver': null or empty.");
}
- if ((null == url) || ("".equals(url))) {
+ if (MText.isBlank(url)) {
throw new IllegalArgumentException("Invalid 'url': null or empty.");
}
if (null == username) {
}
public MSqlStatementResults executePreparedStatement(String statement, LinkedList<Object> parameters) throws MStatementSqlException {
- if ((null == statement) || ("".equals(statement))) {
+ if (MText.isBlank(statement)) {
throw new IllegalArgumentException("Invalid 'statement': null or empty.");
}
if (null == parameters) {
package com.marcozanon.macaco.sql;
import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
public class MSqlConnectionGenerator extends MObject {
public MSqlConnectionGenerator(String driver, String url, String username, String password) {
super();
//
- if ((null == driver) || ("".equals(driver))) {
+ if (MText.isBlank(driver)) {
throw new IllegalArgumentException("Invalid 'driver': null or empty.");
}
- if ((null == url) || ("".equals(url))) {
+ if (MText.isBlank(url)) {
throw new IllegalArgumentException("Invalid 'url': null or empty.");
}
if (null == username) {
package com.marcozanon.macaco.sql;
import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
}
public LinkedList<Object> getRecordsByField(String field) {
- if ((null == field) || ("".equals(field))) {
+ if (MText.isBlank(field)) {
throw new IllegalArgumentException("Invalid 'field': null or empty.");
}
//
package com.marcozanon.macaco.sql;
import com.marcozanon.macaco.MObject;
+import com.marcozanon.macaco.text.MText;
import java.util.LinkedHashMap;
import java.util.LinkedList;
if (null == connection) {
throw new IllegalArgumentException("Invalid 'connection': null.");
}
- if ((null == table) || ("".equals(table))) {
+ if (MText.isBlank(table)) {
throw new IllegalArgumentException("Invalid 'table': null or empty.");
}
- if ((null == primaryKey) || ("".equals(primaryKey))) {
+ if (MText.isBlank(primaryKey)) {
throw new IllegalArgumentException("Invalid 'primaryKey': null or empty.");
}
//
}
public void parseFile(String file) throws MTranslationFileParsingTextException {
- if ((null == file) || ("".equals(file))) {
+ if (MText.isBlank(file)) {
throw new IllegalArgumentException("Invalid 'file': null or empty.");
}
//
break;
}
line = line.trim();
- if ("".equals(line)) {
+ if (MText.isEmpty(line)) {
message = null;
continue;
}
}
protected String getTranslation(String message, Locale locale, boolean strictMode) throws MTranslationValueNotFoundTextException {
- if ((null == message) || ("".equals(message))) {
+ if (MText.isBlank(message)) {
throw new IllegalArgumentException("Invalid 'message': null or empty.");
}
if (null == locale) {