@Override public String getPlainText () { return StringHelper.getNotNull (m_sValue); }
@Override @Nonnull public String getPlainText () { return StringHelper.getNotNull (m_sValue); }
@Override @Nonnull public String getPlainText () { return StringHelper.getNotNull (m_sLabel); } }
@Nonnull public HCTextNode setText (@Nullable final String sText) { m_sText = StringHelper.getNotNull (sText); return this; }
/** * Get the passed string but never return <code>null</code>. If the passed * parameter is <code>null</code> an empty string is returned. * * @param s * The parameter to be not <code>null</code>. * @return An empty string if the passed parameter is <code>null</code>, the * passed string otherwise. */ @Nonnull public static String getNotNull (@Nullable final String s) { return getNotNull (s, ""); }
/** * Get the passed {@link CharSequence} but never return <code>null</code>. If * the passed parameter is <code>null</code> an empty string is returned. * * @param s * The parameter to be not <code>null</code>. * @return An empty string if the passed parameter is <code>null</code>, the * passed {@link CharSequence} otherwise. */ @Nonnull public static CharSequence getNotNull (@Nullable final CharSequence s) { return getNotNull (s, ""); }
@Nonnull private static String _createLocaleKey (@Nullable final String sLanguage, @Nullable final String sCountry, @Nullable final String sVariant) { final String sRealLanguage = StringHelper.getNotNull (LocaleUtils.getValidLanguageCode (sLanguage)); final String sRealCountry = StringHelper.getNotNull (LocaleUtils.getValidCountryCode (sCountry)); final String sRealVariant = StringHelper.getNotNull (sVariant); return _buildLocaleString (sRealLanguage, sRealCountry, sRealVariant); }
@Nonnull public static String stringReplacePattern (@Nonnull @RegEx final String sRegEx, @Nonnegative final int nOptions, @Nonnull final String sValue, @Nullable final String sReplacement) { // Avoid NPE on invalid replacement parameter return getMatcher (sRegEx, nOptions, sValue).replaceAll (StringHelper.getNotNull (sReplacement)); }
@Nonnull @Nonempty public String getLocationAsString () { final String sFirst = getFirstTokenLocationAsString (); final String sLast = getLastTokenLocationAsString (); return StringHelper.getNotNull (sFirst, "") + "-" + StringHelper.getNotNull (sLast, ""); }
@Nonnull @Nonempty public String getLocationAsString () { final String sFirst = getFirstTokenLocationAsString (); final String sLast = getLastTokenLocationAsString (); return StringHelper.getNotNull (sFirst, "") + "-" + StringHelper.getNotNull (sLast, ""); }
@Nonnull public MarkdownProcessingResult process (@Nullable final String sText) throws IOException { return process (new NonBlockingStringReader (StringHelper.getNotNull (sText))); }
/** * Same as {@link #replaceAll(String, String, CharSequence)} but allowing for * a <code>null</code> new-value, which is than interpreted as an empty string * instead. * * @param sInputString * The input string where the text should be replace. If this parameter * is <code>null</code> or empty, no replacement is done. * @param sSearchText * The string to be replaced. May neither be <code>null</code> nor * empty. * @param aReplacementText * The string with the replacement. May be <code>null</code> or empty. * @return The input string as is, if the input string is empty or if the * string to be replaced is not contained. */ public static String replaceAllSafe (@Nullable final String sInputString, @Nonnull final String sSearchText, @Nullable final CharSequence aReplacementText) { return replaceAll (sInputString, sSearchText, getNotNull (aReplacementText, "")); }
@Nullable public static HCA_MailTo createLinkedEmail (@Nullable final String sAddress, @Nullable final String sPersonal) { if (StringHelper.hasNoText (sAddress)) return null; final HCA_MailTo ret = new HCA_MailTo (sAddress); ret.addChild (StringHelper.getNotNull (sPersonal, sAddress)); return ret; } }
private static String getTrackingOptOutMessage (@Nullable final Locale aDisplayLocale, @Nullable final String sTrackingOptOutMessage) { if (StringHelper.hasText (sTrackingOptOutMessage)) { return sTrackingOptOutMessage; } String sMsg = EText.MSG_TRACKING_OPT_OUT.getTextWithLocaleFallback (aDisplayLocale == null ? TextProvider.EN : aDisplayLocale); return StringHelper.getNotNull (sMsg, EText.MSG_TRACKING_OPT_OUT.getTextWithLocaleFallback (TextProvider.EN)); }
@Nullable final String sVariant) final String sRealLanguage = StringHelper.getNotNull (LocaleUtils.getValidLanguageCode (sLanguage)); final String sRealCountry = StringHelper.getNotNull (LocaleUtils.getValidCountryCode (sCountry)); final String sRealVariant = StringHelper.getNotNull (sVariant); final String sLocaleKey = _buildLocaleString (sRealLanguage, sRealCountry, sRealVariant); if (sLocaleKey.length () == 0)
/** * Parse the given fragment as XHTML 1.1. This is a sanity method for * {@link #parseXHTMLFragment(String)} with the predefined XHTML 1.1 document * type. * * @param sXHTMLFragment * The XHTML fragment to parse. May be <code>null</code>. * @return <code>null</code> if parsing failed. */ @Nullable public IMicroDocument parseXHTMLFragment (@Nullable final String sXHTMLFragment) { // Build mini HTML and insert fragment in the middle. // If parsing succeeds, it is considered valid HTML. final String sHTMLNamespaceURI = this.m_eHTMLVersion.getNamespaceURI (); final String sXHTML = XMLEmitterPhloc.getDocTypeHTMLRepresentation (EXMLSerializeVersion.XML_10, EXMLIncorrectCharacterHandling.DEFAULT, this.m_eHTMLVersion.getDocType ()) + "<html" + (sHTMLNamespaceURI != null ? ' ' + CXML.XML_ATTR_XMLNS + "=\"" + sHTMLNamespaceURI + '"' : "") + "><head><title></title></head><body>" + StringHelper.getNotNull (sXHTMLFragment) + "</body></html>"; return parseXHTMLDocument (sXHTML); }
if (bEmitNamespaces) final String sElementNamespaceURI = StringHelper.getNotNull (aElement.getNamespaceURI ()); final String sDefaultNamespaceURI = StringHelper.getNotNull (m_aNSStack.getDefaultNamespaceURI ()); final boolean bIsDefaultNamespace = sElementNamespaceURI.equals (sDefaultNamespaceURI); if (!bIsDefaultNamespace)
if (bEmitNamespaces) final String sElementNamespaceURI = StringHelper.getNotNull (aElement.getNamespaceURI ()); final String sDefaultNamespaceURI = StringHelper.getNotNull (m_aNSStack.getDefaultNamespaceURI ()); final boolean bIsDefaultNamespace = sElementNamespaceURI.equals (sDefaultNamespaceURI); if (!bIsDefaultNamespace)