/** * @return <code>true</code> if a conditional comment is present, * <code>false</code> if not. */ public boolean hasConditionalComment () { return StringHelper.hasText (m_sConditionalComment); }
public MicroDataAware (@Nullable final CharSequence aText) { if (StringHelper.hasNoText (aText)) m_aSB = new StringBuilder (); else m_aSB = new StringBuilder (aText); }
/** * The default implementation returns the given URL String as-is. Use * {@link #setEncodeUrlSuffix(String)} to define a suffix to be appended. * * @return the encoded URL */ @Nullable public String encodeURL (@Nullable final String sUrl) { if (StringHelper.hasText (m_sEncodeUrlSuffix)) return StringHelper.getNotNull (sUrl) + m_sEncodeUrlSuffix; return sUrl; }
public void put (@Nonnull final String sPath, @Nullable final Object aValue) { // replace everything just to have opening separators ("[") left and only // one closing separator ("]") at the end String sRealPath = StringHelper.replaceAll (sPath, s_sClose + s_sOpen, s_sOpen); // Remove the remaining trailing closing separator sRealPath = StringHelper.trimEnd (sRealPath, s_sClose); // Remove any remaining opening closing separator because this indicates and // invalid level (as e.g. in 'columns[0][]') sRealPath = StringHelper.trimEndRepeatedly (sRealPath, s_sOpen); // Start parsing _parseAndAddItem (m_aMap, sRealPath, aValue); }
@OverrideOnDemand protected String getCellText (@Nullable final IHCCell <?> aCell) { if (aCell == null) return ""; String sText = aCell.getPlainText (); // strip common prefix and suffix if (StringHelper.hasText (m_sCommonPrefix)) sText = StringHelper.trimStart (sText, m_sCommonPrefix); if (StringHelper.hasText (m_sCommonSuffix)) sText = StringHelper.trimEnd (sText, m_sCommonSuffix); return sText; }
@Override public boolean canConvertToMicroNode (@Nonnull final IHCConversionSettingsToNode aConversionSettings) { if (m_sCachedJSCode == null) m_sCachedJSCode = StringHelper.trim (getJSCode (aConversionSettings.getJSWriterSettings ())); // Don't create script elements with empty content.... return StringHelper.hasText (m_sCachedJSCode); }
@Nonnull public static AcceptLanguageList getAcceptLanguages (@Nullable final String sAcceptLanguage) { final AcceptLanguageList ret = new AcceptLanguageList (); if (StringHelper.hasNoText (sAcceptLanguage)) { // No definition - access all ret.addLanguage (ANY_LANGUAGE, QValue.MAX_QUALITY); } else { // Languages are separated by "," or ", " for (final String sItem : StringHelper.getExploded (',', sAcceptLanguage)) { // Qualities are separated by ";" final String [] aParts = StringHelper.getExplodedArray (';', sItem.trim (), 2); // Default quality is 1 double dQuality = QValue.MAX_QUALITY; if (aParts.length == 2 && aParts[1].trim ().startsWith ("q=")) dQuality = StringParser.parseDouble (aParts[1].trim ().substring (2), QValue.MAX_QUALITY); ret.addLanguage (aParts[0], dQuality); } } return ret; } }
@Nonnull public static String getTextWithState (@Nonnull final String sText, @Nonnull final ELabelType eType) { ValueEnforcer.notNull (sText, "Text"); ValueEnforcer.notNull (eType, "Type"); // Trim optional trailing colon String sPlainText = StringHelper.trimEnd (sText.trim (), LABEL_END); // Append suffix only, if at least some text is present if (StringHelper.hasText (sPlainText)) sPlainText += getSuffix (eType, !StringHelper.endsWith (sPlainText, '?')); return sPlainText; }
@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; } }
if (StringHelper.startsWith (sOrigValue, '[') && StringHelper.endsWith (sOrigValue, ']')) if (aObjStart[2] != null) sValue = StringHelper.getConcatenatedOnDemand (aObjStart[0], aObjStart[2]).trim (); if (sValue.length () > 0) sValue = StringHelper.replaceAll (sValue, "; ", ";\n"); aParts.addAll (StringHelper.getExploded ('\n', sValue));
@Override @Nonnull public String getPlainText () { return StringHelper.getNotNull (m_sLabel); } }
private EGenericodeDocumentType (@Nonnull final Class <?> aClass, @Nonnull final List <? extends ClassPathResource> aXSDPaths) { m_aDocType = new JAXBDocumentType (aClass, aXSDPaths, x -> StringHelper.trimEnd (x, "Document")); }
@Nonnull private static String _fixFormatter (@Nonnull final String s) { String ret = s; ret = StringHelper.replaceAll (ret, 'y', 'Y'); ret = StringHelper.replaceAll (ret, 'd', 'D'); return ret; }
@Nonnull public static PModeAddressList createFromString (@Nullable final String sAddressString) { final ICommonsList <String> aAddresses = StringHelper.getExploded (ADDRESS_SEPARATOR, sAddressString); return new PModeAddressList (aAddresses); } }
@Nullable public String getAsText () { return StringHelper.getImploded (m_aContent); }
@Nonnull private static String _getRealMessage (@Nullable final String sMsg, @Nullable final Throwable aCause) { final String ret = StringHelper.getNotNull (sMsg); final String sFaultMessage = SMLExceptionHelper.getFaultMessage (aCause); return StringHelper.getConcatenatedOnDemand (ret, " - ", sFaultMessage); }
/** * Clean the provided path and split it into parts. * * @param sPath * Source path * @return The list with all path parts. Never <code>null</code>. */ @Nonnull @ReturnsMutableCopy public static ICommonsList <String> getCleanPathParts (@Nonnull final String sPath) { // Remove leading and trailing whitespaces and slashes String sRealPath = StringHelper.trimStartAndEnd (sPath.trim (), "/", "/"); // Remove obscure path parts sRealPath = FilenameHelper.getCleanPath (sRealPath); // Split into pieces final ICommonsList <String> aPathParts = StringHelper.getExploded ('/', sRealPath); return aPathParts; } }
/** * A String of text to postpend (add to the end) to the instanceId found in the * system property. * * @param postpend * the value to postpend, or null if none is desired. */ public void setPostpend (@Nullable final String postpend) { m_sPostpend = StringHelper.trim (postpend); }
@OverrideOnDemand protected String getCellText (@Nullable final IHCCell <?> aCell) { if (aCell == null) return ""; String sText = aCell.getPlainText (); // strip common prefix and suffix if (StringHelper.hasText (m_sCommonPrefix)) sText = StringHelper.trimStart (sText, m_sCommonPrefix); if (StringHelper.hasText (m_sCommonSuffix)) sText = StringHelper.trimEnd (sText, m_sCommonSuffix); return sText; }
@Nullable public static CSSHSLA getParsedHSLAColorValue (@Nullable final String sValue) { final String sRealValue = StringHelper.trim (sValue); if (StringHelper.hasText (sRealValue) && sRealValue.startsWith (CCSSValue.PREFIX_HSLA)) { final String [] aValues = RegExHelper.getAllMatchingGroupValues (PATTERN_HSLA, sRealValue); if (aValues != null) return new CSSHSLA (aValues[0], aValues[1], aValues[2], aValues[3]); } return null; }