当前位置: 首页>>代码示例>>Java>>正文


Java StringHelper.hasText方法代码示例

本文整理汇总了Java中com.helger.commons.string.StringHelper.hasText方法的典型用法代码示例。如果您正苦于以下问题:Java StringHelper.hasText方法的具体用法?Java StringHelper.hasText怎么用?Java StringHelper.hasText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.helger.commons.string.StringHelper的用法示例。


在下文中一共展示了StringHelper.hasText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createEbms3MessageInfo

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
 * Create a new message info.
 *
 * @param sMessageID
 *        The message ID. May neither be <code>null</code> nor empty.
 * @param sRefToMessageID
 *        to set the reference to the previous message needed for two way
 *        exchanges
 * @return Never <code>null</code>.
 */
@Nonnull
public static Ebms3MessageInfo createEbms3MessageInfo (@Nonnull @Nonempty final String sMessageID,
                                                       @Nullable final String sRefToMessageID)
{
  ValueEnforcer.notEmpty (sMessageID, "MessageID");

  final Ebms3MessageInfo aMessageInfo = new Ebms3MessageInfo ();

  aMessageInfo.setMessageId (sMessageID);
  if (StringHelper.hasText (sRefToMessageID))
    aMessageInfo.setRefToMessageId (sRefToMessageID);

  aMessageInfo.setTimestamp (PDTXMLConverter.getXMLCalendarNowUTC ());
  return aMessageInfo;
}
 
开发者ID:phax,项目名称:ph-as4,代码行数:26,代码来源:MessageHelperMethods.java

示例2: _initCertificateIssuers

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
private static void _initCertificateIssuers ()
{
  // Get the certificate issuer we need
  final String sIssuerToSearch = PDServerConfiguration.getClientCertIssuer ();
  if (StringHelper.hasNoText (sIssuerToSearch))
    throw new InitializationException ("The configuration file is missing the entry for the client certificate issuer");

  // Throws a runtime exception on syntax error anyway :)
  s_aSearchIssuers.add (new X500Principal (sIssuerToSearch));

  // Optional alternative issuer
  final String sIssuerToSearchAlternative = PDServerConfiguration.getClientCertIssuerAlternative ();
  if (StringHelper.hasText (sIssuerToSearchAlternative))
  {
    // Throws a runtime exception on syntax error anyway :)
    s_aSearchIssuers.add (new X500Principal (sIssuerToSearchAlternative));
  }

  s_aLogger.info ("The following client certificate issuer(s) are valid: " + s_aSearchIssuers);
}
 
开发者ID:phax,项目名称:peppol-directory,代码行数:21,代码来源:ClientCertificateValidator.java

示例3: isMinimal

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
public boolean isMinimal ()
{
  if (m_bAbstract)
    return false;
  if (StringHelper.hasText (m_sIsA))
    return false;
  for (final PSInclude aInclude : m_aIncludes)
    if (!aInclude.isMinimal ())
      return false;
  if (m_aTitle != null && !m_aTitle.isMinimal ())
    return false;
  for (final IPSElement aContent : m_aContent)
    if (!aContent.isMinimal ())
      return false;
  return true;
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:17,代码来源:PSPattern.java

示例4: convertToMicroElement

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nonnull
public IMicroElement convertToMicroElement (@Nonnull final PersonName aValue,
                                            @Nullable final String sNamespaceURI,
                                            @Nonnull final String sTagName)
{
  final IMicroElement eName = new MicroElement (sNamespaceURI, sTagName);
  if (aValue.getSalutation () != null)
    eName.setAttribute (ATTR_SALUTATION, aValue.getSalutationID ());
  if (StringHelper.hasText (aValue.getPrefixTitle ()))
    eName.setAttribute (ATTR_PREFIXTITLE, aValue.getPrefixTitle ());
  if (StringHelper.hasText (aValue.getFirstName ()))
    eName.setAttribute (ATTR_FIRSTNAME, aValue.getFirstName ());
  if (StringHelper.hasText (aValue.getMiddleName ()))
    eName.setAttribute (ATTR_MIDDLENAME, aValue.getMiddleName ());
  if (StringHelper.hasText (aValue.getLastName ()))
    eName.setAttribute (ATTR_LASTNAME, aValue.getLastName ());
  if (StringHelper.hasText (aValue.getSuffixTitle ()))
    eName.setAttribute (ATTR_SUFFIXTITLE, aValue.getSuffixTitle ());
  return eName;
}
 
开发者ID:phax,项目名称:ph-masterdata,代码行数:21,代码来源:PersonNameMicroTypeConverter.java

示例5: getAsURI

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
 * Get the passed String as an URI. If the string is empty or not an URI
 * <code>null</code> is returned.
 *
 * @param sURI
 *        Source URI. May be <code>null</code>.
 * @return <code>null</code> if the passed URI is empty or invalid.
 */
@Nullable
public static URI getAsURI (@Nullable final String sURI)
{
  if (StringHelper.hasText (sURI))
    try
    {
      return new URI (sURI);
    }
    catch (final URISyntaxException ex)
    {
      // fall-through
      if (GlobalDebug.isDebugMode ())
        s_aLogger.warn ("Debug warn: failed to convert '" + sURI + "' to a URI!");
    }
  return null;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:25,代码来源:URLHelper.java

示例6: createEbms3CollaborationInfo

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nonnull
public static Ebms3CollaborationInfo createEbms3CollaborationInfo (@Nonnull final String sAction,
                                                                   @Nullable final String sServiceType,
                                                                   @Nonnull final String sServiceValue,
                                                                   @Nonnull final String sConversationID,
                                                                   @Nullable final String sAgreementRefPMode,
                                                                   @Nullable final String sAgreementRefValue)
{
  final Ebms3CollaborationInfo aEbms3CollaborationInfo = new Ebms3CollaborationInfo ();
  aEbms3CollaborationInfo.setAction (sAction);
  {
    final Ebms3Service aEbms3Service = new Ebms3Service ();
    aEbms3Service.setType (sServiceType);
    aEbms3Service.setValue (sServiceValue);
    aEbms3CollaborationInfo.setService (aEbms3Service);
  }
  aEbms3CollaborationInfo.setConversationId (sConversationID);
  if (StringHelper.hasText (sAgreementRefValue))
  {
    final Ebms3AgreementRef aEbms3AgreementRef = new Ebms3AgreementRef ();
    if (StringHelper.hasText (sAgreementRefPMode))
      aEbms3AgreementRef.setPmode (sAgreementRefPMode);
    aEbms3AgreementRef.setValue (sAgreementRefValue);
    aEbms3CollaborationInfo.setAgreementRef (aEbms3AgreementRef);
  }
  return aEbms3CollaborationInfo;
}
 
开发者ID:phax,项目名称:ph-as4,代码行数:28,代码来源:UserMessageCreator.java

示例7: _isUseLeg1

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
 * Checks if Leg1 should be used or not.
 *
 * @param aUserMessage
 *        needed to get the message ids
 * @return true if leg1 should be used else false
 */
private static boolean _isUseLeg1 (@Nonnull final Ebms3UserMessage aUserMessage)
{
  final String sThisMessageID = aUserMessage.getMessageInfo ().getMessageId ();
  final String sRefToMessageID = aUserMessage.getMessageInfo ().getRefToMessageId ();

  if (StringHelper.hasText (sRefToMessageID))
    if (sThisMessageID.equals (sRefToMessageID))
      s_aLogger.warn ("MessageID and ReferenceToMessageID are the same!");

  // If the message has a non-empty reference to a previous message, and this
  // reference differs from this message's ID, than leg 2 should be used
  return StringHelper.hasNoText (sRefToMessageID) || sRefToMessageID.equals (sThisMessageID);
}
 
开发者ID:phax,项目名称:ph-as4,代码行数:21,代码来源:SOAPHeaderElementProcessorExtractEbms3Messaging.java

示例8: create

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nonnull
public static ParserQName create (@Nonnull @Nonempty final String s1, @Nullable final String s2)
{
  if (StringHelper.hasText (s2))
    return new ParserQName (s1, s2);
  return new ParserQName (null, s1);
}
 
开发者ID:phax,项目名称:ph-stx,代码行数:8,代码来源:ParserQName.java

示例9: _initRootCertAlternative

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
private static void _initRootCertAlternative ()
{
  // Get data from config file
  final EKeyStoreType eTrustStoreType = PDServerConfiguration.getTrustStoreTypeAlternative ();
  final String sTrustStorePath = PDServerConfiguration.getTrustStorePathAlternative ();
  final String sTrustStorePassword = PDServerConfiguration.getTrustStorePasswordAlternative ();
  final String sTrustStoreAlias = PDServerConfiguration.getTrustStoreAliasAlternative ();

  if (StringHelper.hasText (sTrustStorePath) &&
      StringHelper.hasText (sTrustStorePassword) &&
      StringHelper.hasText (sTrustStorePath))
  {
    // Load keystores
    try
    {
      final KeyStore aKS = KeyStoreHelper.loadKeyStoreDirect (eTrustStoreType, sTrustStorePath, sTrustStorePassword);
      s_aPeppolSMPRootCertAlternative = (X509Certificate) aKS.getCertificate (sTrustStoreAlias);
    }
    catch (final Throwable t)
    {
      final String sErrorMsg = "Failed to read alternative trust store from '" + sTrustStorePath + "'";
      s_aLogger.error (sErrorMsg);
      throw new InitializationException (sErrorMsg, t);
    }

    // Check if both root certificates could be loaded
    if (s_aPeppolSMPRootCertAlternative == null)
      throw new InitializationException ("Failed to resolve alias '" +
                                         sTrustStoreAlias +
                                         "' in alternative trust store!");
    s_aLogger.info ("Alternative root certificate loaded successfully from trust store '" +
                    sTrustStorePath +
                    "' with alias '" +
                    sTrustStoreAlias +
                    "'; root certificate serial=" +
                    s_aPeppolSMPRootCertAlternative.getSerialNumber ().toString (16) +
                    "; root certficate issuer=" +
                    s_aPeppolSMPRootCertAlternative.getIssuerX500Principal ().getName ());
  }
}
 
开发者ID:phax,项目名称:peppol-directory,代码行数:41,代码来源:ClientCertificateValidator.java

示例10: getFirstHeaderValue

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
 * Get the first header value of a certain header name
 *
 * @param sName
 *        The name to be searched.
 * @return The first matching value or <code>null</code>.
 */
@Nullable
public String getFirstHeaderValue (@Nullable final String sName)
{
  if (StringHelper.hasText (sName))
  {
    final ICommonsList <String> aValues = m_aHeaders.get (getUnifiedName (sName));
    if (aValues != null)
      return aValues.getFirst ();
  }
  return null;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:19,代码来源:HttpHeaderMap.java

示例11: getRuleOfID

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nullable
public PSRule getRuleOfID (@Nullable final String sID)
{
  if (StringHelper.hasText (sID))
    for (final IPSElement aElement : m_aContent)
      if (aElement instanceof PSRule)
      {
        final PSRule aRule = (PSRule) aElement;
        if (sID.equals (aRule.getID ()))
          return aRule;
      }
  return null;
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:14,代码来源:PSPattern.java

示例12: getAsCSSString

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nonnull
@Nonempty
public String getAsCSSString (@Nonnull final ICSSWriterSettings aSettings, @Nonnegative final int nIndentLevel)
{
  // Always ignore unknown rules?
  if (!aSettings.isWriteUnknownRules ())
    return "";

  final boolean bOptimizedOutput = aSettings.isOptimizedOutput ();

  final StringBuilder aSB = new StringBuilder (m_sDeclaration);

  if (StringHelper.hasText (m_sParameterList))
    aSB.append (' ').append (m_sParameterList);

  if (StringHelper.hasNoText (m_sBody))
  {
    aSB.append (bOptimizedOutput ? "{}" : " {}" + aSettings.getNewLineString ());
  }
  else
  {
    // At least one rule present
    aSB.append (bOptimizedOutput ? "{" : " {" + aSettings.getNewLineString ());
    if (!bOptimizedOutput)
      aSB.append (aSettings.getIndent (nIndentLevel));
    aSB.append (m_sBody);
    if (!bOptimizedOutput)
      aSB.append (aSettings.getIndent (nIndentLevel));
    aSB.append ('}');
    if (!bOptimizedOutput)
      aSB.append (aSettings.getNewLineString ());
  }
  return aSB.toString ();
}
 
开发者ID:phax,项目名称:ph-css,代码行数:35,代码来源:CSSUnknownRule.java

示例13: maskXMLTextTo

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
public static void maskXMLTextTo (@Nonnull final EXMLSerializeVersion eXMLVersion,
                                  @Nonnull final EXMLCharMode eXMLCharMode,
                                  @Nonnull final EXMLIncorrectCharacterHandling eIncorrectCharHandling,
                                  @Nullable final String s,
                                  @Nonnull final Writer aWriter) throws IOException
{
  if (StringHelper.hasText (s))
    maskXMLTextTo (eXMLVersion, eXMLCharMode, eIncorrectCharHandling, s.toCharArray (), 0, s.length (), aWriter);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:10,代码来源:XMLMaskHelper.java

示例14: _getDefaultNamespaceURI

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
 * @return The namespace URI that is currently active in the stack. May be
 *         <code>null</code> for no specific namespace.
 */
@Nullable
private String _getDefaultNamespaceURI ()
{
  // iterate from front to end
  for (final NamespaceLevel aNSLevel : m_aStack)
  {
    final String sDefaultNamespaceURI = aNSLevel.getDefaultNamespaceURI ();
    if (StringHelper.hasText (sDefaultNamespaceURI))
      return sDefaultNamespaceURI;
  }

  // no default namespace
  return null;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:19,代码来源:AbstractXMLSerializer.java

示例15: getValidCountryCode

import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nullable
public static String getValidCountryCode (@Nullable final String sCode)
{
  if (StringHelper.hasText (sCode) && RegExHelper.stringMatchesPattern ("[a-zA-Z]{2}|[0-9]{3}", sCode))
  {
    return sCode.toUpperCase (CGlobal.LOCALE_FIXED_NUMBER_FORMAT);
  }
  return null;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:10,代码来源:LocaleHelper.java


注:本文中的com.helger.commons.string.StringHelper.hasText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。