@Override public String toString() { return MSystem.toString(this, getStatusAsString()); } }
@Override public boolean getBoolean(String name, boolean def) { Object out; try { out = getProperty(name); } catch (Throwable e) { return def; } return MCast.toboolean(out, def); }
@Override public float getFloat(String name, float def) { Object out; try { out = getProperty(name); } catch (Throwable e) { return def; } return MCast.tofloat(out, def); }
public static MProperties load(InputStream inStream) throws IOException { MProperties out = new MProperties(); out.load0(new LineReader(inStream)); return out; }
@Override public long getLong(String name, long def) { Object out; try { out = getProperty(name); } catch (Throwable e) { return def; } return MCast.tolong(out, def); }
@Override public double getDouble(String name, double def) { Object out; try { out = getProperty(name); } catch (Throwable e) { return def; } return MCast.todouble(out,def); }
@Override public Date getDate(String name) { try { Object out = getProperty(name); return MCast.toDate(out, null); } catch (Throwable t) {} return null; }
@Override public int getInt(String name, int def) { Object out; try { out = getProperty(name); } catch (Throwable e) { return def; } return MCast.toint(out,def); }
public String getCurrentTimeAsString() { return MPeriod.getIntervalAsString(getCurrentTime()); }
/** * Return true if the the string is not empty also trimmed. * * @param _in The string to test * @return true if the string is not null and not an empty string and not only contains whitespaces */ public static boolean isSetTrim(String _in) { return !isEmptyTrim(_in); }
public MTimerTask() { setName(MSystem.getClassName(this)); }
/** * Returns an iterator of elements with this name in the given root element on the first level only. * * @param root * @param name * @return every time an iterator - never null */ public static ElementIterator getLocalElementIterator(Element root, String name) { return new ElementIterator(getLocalElements(root,name)); }
public static String freeMemoryAsString() { long free = freeMemory(); return MString.toByteDisplayString(free); }
@Override public Calendar getCalendar(String name) throws MException { Object out = getProperty(name); return MCast.toCalendar(out); }
/** * Truncate the string by length characters. * * @param in String to truncate * @param length Max length * @return Same or truncated string */ public static String trunc(String in, int length) { return MString.truncate(in, length); }
/** * Returns the inner XML Structure as string with all tag definitions. * * @param node * @return inner structure as string */ public static String innerXml(org.w3c.dom.Node node) { return innerXml(node, true); }
public String getName() { if (tc != null) return tc.getName(); return ""; }
@Override public Number getNumber(String name, Number def) { Object out = getProperty(name); if (out == null) return def; if (out instanceof Number) return (Number)out; try { return MCast.todouble(out, 0); } catch (NumberFormatException e) { return def; } }
/** * Returns an iterator of all elements in the given root element on the first level only. * * @param root * @return iterator of the requested elements */ public static ElementIterator getLocalElementIterator(Element root) { return new ElementIterator(getLocalElements(root)); }