@Nullable public static String makeDataAttrName (@Nullable final String sName) { return StringHelper.hasNoText (sName) ? sName : CHTMLAttributes.HTML5_PREFIX_DATA + sName; }
public MicroDataAware (@Nullable final CharSequence aText) { if (StringHelper.hasNoText (aText)) m_aSB = new StringBuilder (); else m_aSB = new StringBuilder (aText); }
@Nonnull public DataTables setTextLoadingURL (@Nullable final ISimpleURL aTextLoadingURL, @Nullable final String sTextLoadingURLLocaleParameterName) { if (aTextLoadingURL != null && StringHelper.hasNoText (sTextLoadingURLLocaleParameterName)) throw new IllegalArgumentException ("If a text loading URL is present, a text loading URL locale parameter name must also be present"); this.m_aTextLoadingURL = aTextLoadingURL; this.m_sTextLoadingURLLocaleParameterName = sTextLoadingURLLocaleParameterName; return this; }
@Nullable public static ReadonlyTelephoneNumber createOnDemandLineOnly (@Nullable final String sLine) { if (StringHelper.hasNoText (sLine)) return null; return new ReadonlyTelephoneNumber ((ETelephoneType) null, (String) null, (String) null, sLine, (String) null); } }
public ActionExecutorDataTablesI18N (@Nonnull final Locale aDefaultLocale) { ValueEnforcer.notNull (aDefaultLocale, "DefaultLocale"); if (StringHelper.hasNoText (aDefaultLocale.getLanguage ())) throw new IllegalArgumentException ("defaultLocale muts have a language: " + aDefaultLocale); this.m_aDefaultLocale = aDefaultLocale; }
@Nullable private static String _getUntilLast (@Nullable final String sStr, @Nullable final String sSearch, final boolean bIncludingSearchChar) { if (hasNoText (sSearch)) return ""; final int nIndex = getLastIndexOf (sStr, sSearch); return nIndex == STRING_NOT_FOUND ? null : sStr.substring (0, nIndex + (bIncludingSearchChar ? sSearch.length () : 0)); }
public EventType (@Nonnull @Nonempty final String sName) { if (StringHelper.hasNoText (sName)) throw new IllegalArgumentException ("Passed event type name is empty"); m_sName = sName; }
@Nullable public String getApplicationIDFromApplicationScopeID (@Nullable final String sApplicationScopeID) { if (StringHelper.hasNoText (sApplicationScopeID)) return null; final String sPrefix = _getApplicationScopeIDPrefix (); if (sApplicationScopeID.startsWith (sPrefix)) return sApplicationScopeID.substring (sPrefix.length ()); // Not a valid application scope ID return null; }
@Nullable public static HCConditionalCommentNode getFromStringOrNull (@Nullable final String sValue, @Nonnull final IHCNode aWrappedNode) { if (StringHelper.hasNoText (sValue)) return null; return new HCConditionalCommentNode (sValue, aWrappedNode); } }
@Nullable public <DSTTYPE> DSTTYPE getAttributeWithConversion (@Nullable final String sAttrName, @Nonnull final Class <DSTTYPE> aDstClass) { final String sAttrVal = getAttribute (sAttrName); // Avoid having a conversion issue with empty strings! if (StringHelper.hasNoText (sAttrVal)) return null; // throws IllegalArgumentException if nothing can be converted final DSTTYPE ret = TypeConverter.convertIfNecessary (sAttrVal, aDstClass); return ret; }
@Nullable public static HCA createLinkedWebsite (@Nullable final String sWebsite) { if (StringHelper.hasNoText (sWebsite)) return null; return new HCA (sWebsite).addChild (sWebsite); } }
@Nullable public static ExtendedEmailAddress createOnDemand (@Nullable final String sAddress) { if (StringHelper.hasNoText (sAddress)) return null; final ExtendedEmailAddress ret = new ExtendedEmailAddress (); ret.setAddress (sAddress); return ret; } }
@Nullable public static TelephoneNumber createOnDemandLineOnly (@Nullable final String sLine) { if (StringHelper.hasNoText (sLine)) return null; final TelephoneNumber ret = new TelephoneNumber (); ret.setLine (sLine); return ret; } }
@Nullable public <DSTTYPE> DSTTYPE getTextContentWithConversion (@Nonnull final Class <DSTTYPE> aDstClass) { // Get the regular content final String sTextContent = getTextContent (); // Avoid having a conversion issue with empty strings! if (StringHelper.hasNoText (sTextContent)) return null; final DSTTYPE ret = TypeConverter.convertIfNecessary (sTextContent, aDstClass); return ret; }
@Override protected final long asLong (@Nullable final IHCCell <?> aCell) { final String sText = getCellText (aCell); // Ensure that columns without text are sorted consistently compared to the // ones with non-numeric content if (StringHelper.hasNoText (sText)) return -1; return LocaleFormatter.parseLong (sText, m_aLocale, 0); } }
@Nullable @Deprecated public static String getUserDisplayName (@Nullable final String sUserID) { if (StringHelper.hasNoText (sUserID)) return "Gast"; final IUser aUser = AccessManager.getInstance ().getUserOfID (sUserID); return aUser == null ? sUserID : getUserDisplayName (aUser, Locale.getDefault ()); }
@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; } }
public EmailAddress (@Nonnull final String sAddress, @Nullable final String sPersonal) { ValueEnforcer.notNull (sAddress, "EmailAddress"); if (!EmailAddressUtils.isValid (sAddress)) throw new IllegalArgumentException ("The passed email address '" + sAddress + "' is illegal!"); m_sAddress = EmailAddressUtils.getUnifiedEmailAddress (sAddress); m_sPersonal = StringHelper.hasNoText (sPersonal) ? null : sPersonal; }
@Nullable private static String _getText (@Nonnull final ChangeLogEntry aEntry, @Nonnull final Locale aDisplayLocale) { String ret = aEntry.getText (aDisplayLocale); if (StringHelper.hasNoText (ret)) if (aEntry.getAllTexts ().size () == 1) ret = ContainerHelper.getFirstElement (aEntry.getAllTexts ().getMap ()).getValue (); return ret; }
@Nullable public IHCNode createWebLink (@Nullable final String sWebSite, @Nullable final HCA_Target aTarget) { if (StringHelper.hasNoText (sWebSite)) return null; if (!URLValidator.isValid (sWebSite)) return new HCTextNode (sWebSite); return new HCA (new SimpleURL (sWebSite)).setTarget (aTarget).addChild (sWebSite); }