本文整理汇总了Java中com.helger.commons.string.StringHelper.hasNoText方法的典型用法代码示例。如果您正苦于以下问题:Java StringHelper.hasNoText方法的具体用法?Java StringHelper.hasNoText怎么用?Java StringHelper.hasNoText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.helger.commons.string.StringHelper
的用法示例。
在下文中一共展示了StringHelper.hasNoText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerAndCheck
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
* Check if the passed message ID was already handled.
*
* @param sMessageID
* Message ID to check. May be <code>null</code>.
* @param sProfileID
* Active AS4 profile ID. May be used to define the PMode further. May
* be <code>null</code>.
* @param sPModeID
* Active AS4 PMode ID. May be <code>null</code>.
* @return {@link EContinue#CONTINUE} to continue
*/
@Nonnull
public EContinue registerAndCheck (@Nullable final String sMessageID,
@Nullable final String sProfileID,
@Nullable final String sPModeID)
{
if (StringHelper.hasNoText (sMessageID))
{
// No message ID present - don't check for duplication
return EContinue.CONTINUE;
}
final AS4DuplicateItem aItem = new AS4DuplicateItem (sMessageID, sProfileID, sPModeID);
try
{
m_aRWLock.writeLocked ( () -> {
internalCreateItem (aItem);
});
}
catch (final IllegalArgumentException ex)
{
// ID already in use
return EContinue.BREAK;
}
return EContinue.CONTINUE;
}
示例2: _createPropsFromFile
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nonnull
private static CryptoProperties _createPropsFromFile (@Nullable final String sCryptoPropertiesPath)
{
CryptoProperties aCryptoProps;
if (StringHelper.hasNoText (sCryptoPropertiesPath))
{
// Uses crypto.properties => needs exact name crypto.properties
aCryptoProps = new CryptoProperties (new ClassPathResource ("private-crypto.properties"));
if (!aCryptoProps.isRead ())
aCryptoProps = new CryptoProperties (new ClassPathResource ("crypto.properties"));
}
else
{
aCryptoProps = new CryptoProperties (new ClassPathResource (sCryptoPropertiesPath));
}
return aCryptoProps;
}
示例3: _checkPropertiesOrignalSenderAndFinalRecipient
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
* Checks the mandatory properties OriginalSender and FinalRecipient if those
* two are set.
*
* @param aPropertyList
* the property list that should be checked for the two specific ones
* @throws BadRequestException
* on error
*/
private static void _checkPropertiesOrignalSenderAndFinalRecipient (@Nonnull final List <Ebms3Property> aPropertyList) throws BadRequestException
{
String sOriginalSenderC1 = null;
String sFinalRecipientC4 = null;
for (final Ebms3Property sProperty : aPropertyList)
{
if (sProperty.getName ().equals (CAS4.ORIGINAL_SENDER))
sOriginalSenderC1 = sProperty.getValue ();
else
if (sProperty.getName ().equals (CAS4.FINAL_RECIPIENT))
sFinalRecipientC4 = sProperty.getValue ();
}
if (StringHelper.hasNoText (sOriginalSenderC1))
throw new BadRequestException (CAS4.ORIGINAL_SENDER + " property is empty or not existant but mandatory");
if (StringHelper.hasNoText (sFinalRecipientC4))
throw new BadRequestException (CAS4.FINAL_RECIPIENT + " property is empty or not existant but mandatory");
}
示例4: _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);
}
示例5: getAsIdentifier
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
* Convert an identifier to a programming language identifier by replacing all
* non-word characters with an underscore.
*
* @param s
* The string to convert. May be <code>null</code> or empty.
* @param sReplacement
* The replacement string to be used for all non-identifier characters.
* May be empty but not be <code>null</code>.
* @return The converted string or <code>null</code> if the input string is
* <code>null</code>. Maybe an invalid identifier, if the replacement
* is empty, and the identifier starts with an illegal character, or
* if the replacement is empty and the source string only contains
* invalid characters!
*/
@Nullable
public static String getAsIdentifier (@Nullable final String s, @Nonnull final String sReplacement)
{
ValueEnforcer.notNull (sReplacement, "Replacement");
if (StringHelper.hasNoText (s))
return s;
// replace all non-word characters with the replacement character
// Important: replacement does not need to be quoted, because it is not
// treated as a regular expression!
final String ret = stringReplacePattern ("\\W", s, sReplacement);
if (ret.length () == 0)
return sReplacement;
if (!Character.isJavaIdentifierStart (ret.charAt (0)))
return sReplacement + ret;
return ret;
}
示例6: getCountry
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nullable
public Locale getCountry (@Nullable final String sCountry)
{
if (StringHelper.hasNoText (sCountry))
return null;
// Was something like "_AT" (e.g. the result of getCountry (...).toString
// ()) passed in? -> indirect recursion
if (sCountry.indexOf (LocaleHelper.LOCALE_SEPARATOR) >= 0)
return getCountry (LocaleCache.getInstance ().getLocale (sCountry));
final String sValidCountry = LocaleHelper.getValidCountryCode (sCountry);
if (!containsCountry (sValidCountry))
s_aLogger.warn ("Trying to retrieve unsupported country " + sCountry);
return LocaleCache.getInstance ().getLocale ("", sValidCountry, "");
}
示例7: build
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
* Constructs an Option with the values declared by this {@link Builder}.
*
* @return the new {@link Option}
* @throws IllegalArgumentException
* if neither {@code opt} or {@code longOpt} has been set
*/
@Nonnull
@ReturnsMutableCopy
public Option build ()
{
if (StringHelper.hasNoText (m_sShortOpt) && StringHelper.hasNoText (m_sLongOpt))
throw new IllegalStateException ("Either opt or longOpt must be specified");
if (m_nMaxArgs != INFINITE_VALUES && m_nMaxArgs < m_nMinArgs)
throw new IllegalStateException ("MinArgs (" + m_nMinArgs + ") must be <= MaxArgs (" + m_nMaxArgs + ")");
if (m_nMinArgs == 0 && m_nMaxArgs == 0)
{
if (m_sArgName != null)
throw new IllegalStateException ("ArgName may only be provided if at least one argument is present");
if (m_eMultiplicity.isRequired ())
s_aLogger.warn ("Having a required option without an argument may not be what is desired.");
if (m_eMultiplicity.isRepeatable ())
s_aLogger.warn ("Having a repeatable option without an argument may not be what is desired.");
if (m_cValueSep != DEFAULT_VALUE_SEPARATOR)
throw new IllegalStateException ("ValueSeparator may only be provided if at least one argument is present");
}
return new Option (this);
}
示例8: validateUserMessage
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
public void validateUserMessage (@Nonnull final Ebms3UserMessage aUserMsg, @Nonnull final ErrorList aErrorList)
{
ValueEnforcer.notNull (aUserMsg, "UserMsg");
if (aUserMsg.getMessageInfo () != null)
{
if (StringHelper.hasNoText (aUserMsg.getMessageInfo ().getMessageId ()))
{
aErrorList.add (_createError ("MessageID is missing but is mandatory!"));
}
}
else
{
aErrorList.add (_createError ("MessageInfo is missing but is mandatory!"));
}
if (aUserMsg.getPartyInfo () != null)
{
if (aUserMsg.getPartyInfo ().getTo () != null)
{
if (aUserMsg.getPartyInfo ().getTo ().getPartyIdCount () > 1)
{
aErrorList.add (_createError ("Only 1 PartyID is allowed in PartyTo - part"));
}
}
if (aUserMsg.getPartyInfo ().getFrom () != null)
{
if (aUserMsg.getPartyInfo ().getFrom ().getPartyIdCount () > 1)
{
aErrorList.add (_createError ("Only 1 PartyID is allowed in PartyFrom - part"));
}
}
}
else
{
aErrorList.add (_createError ("At least one PartyInfo element has to be present"));
}
}
示例9: validateSignalMessage
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
public void validateSignalMessage (@Nonnull final Ebms3SignalMessage aSignalMsg, @Nonnull final ErrorList aErrorList)
{
ValueEnforcer.notNull (aSignalMsg, "SignalMsg");
if (StringHelper.hasNoText (aSignalMsg.getMessageInfo ().getMessageId ()))
{
aErrorList.add (_createError ("MessageID is missing but is mandatory!"));
}
}
示例10: getProfileOfID
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nullable
public IAS4Profile getProfileOfID (@Nullable final String sID)
{
if (StringHelper.hasNoText (sID))
return null;
return m_aRWLock.readLocked ( () -> m_aMap.get (sID));
}
示例11: _checkMandatoryAttributes
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
private void _checkMandatoryAttributes ()
{
if (StringHelper.hasNoText (m_sAction))
throw new IllegalStateException ("Action needs to be set");
if (StringHelper.hasNoText (m_sServiceType))
throw new IllegalStateException ("ServiceType needs to be set");
if (StringHelper.hasNoText (m_sServiceValue))
throw new IllegalStateException ("ServiceValue needs to be set");
if (StringHelper.hasNoText (m_sConversationID))
throw new IllegalStateException ("ConversationID needs to be set");
if (StringHelper.hasNoText (m_sAgreementRefValue))
throw new IllegalStateException ("AgreementRefValue needs to be set");
if (StringHelper.hasNoText (m_sFromRole))
throw new IllegalStateException ("FromRole needs to be set");
if (StringHelper.hasNoText (m_sFromPartyID))
throw new IllegalStateException ("FromPartyID needs to be set");
if (StringHelper.hasNoText (m_sToRole))
throw new IllegalStateException ("ToRole needs to be set");
if (StringHelper.hasNoText (m_sToPartyID))
throw new IllegalStateException ("ToPartyID needs to be set");
if (m_aEbms3Properties.isEmpty ())
throw new IllegalStateException ("Mandatory properties finalRecipient and originalSender are missing");
}
示例12: _checkMandatoryAttributes
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
private void _checkMandatoryAttributes ()
{
if (getSOAPVersion () == null)
throw new IllegalStateException ("A SOAPVersion must be set.");
if (m_aErrorMessages.isEmpty ())
throw new IllegalStateException ("No Errors specified!");
if (StringHelper.hasNoText (m_sRefToMessageId))
throw new IllegalStateException ("No reference to a message set.");
}
示例13: _checkKeyStoreAttributes
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
private void _checkKeyStoreAttributes ()
{
if (m_aKeyStoreRes == null)
throw new IllegalStateException ("KeyStore resources is not configured.");
if (!m_aKeyStoreRes.exists ())
throw new IllegalStateException ("KeyStore resources does not exist: " + m_aKeyStoreRes.getPath ());
if (m_aKeyStoreType == null)
throw new IllegalStateException ("KeyStore type is not configured.");
if (m_sKeyStorePassword == null)
throw new IllegalStateException ("KeyStore password is not configured.");
if (StringHelper.hasNoText (m_sKeyStoreAlias))
throw new IllegalStateException ("KeyStore alias is not configured.");
if (m_sKeyStoreKeyPassword == null)
throw new IllegalStateException ("Key password is not configured.");
}
示例14: createMessageID
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nonnull
@Nonempty
protected final String createMessageID ()
{
final String ret = m_aMessageIDFactory.get ();
if (StringHelper.hasNoText (ret))
throw new IllegalStateException ("An empty MessageID was generate!");
return ret;
}
示例15: _checkMandatoryAttributes
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
private void _checkMandatoryAttributes ()
{
if (getSOAPVersion () == null)
throw new IllegalStateException ("A SOAPVersion must be set.");
if (StringHelper.hasNoText (m_sMPC))
throw new IllegalStateException ("A MPC has to be present");
}