本文整理汇总了Java中com.helger.commons.string.StringHelper.getImplodedNonEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java StringHelper.getImplodedNonEmpty方法的具体用法?Java StringHelper.getImplodedNonEmpty怎么用?Java StringHelper.getImplodedNonEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.helger.commons.string.StringHelper
的用法示例。
在下文中一共展示了StringHelper.getImplodedNonEmpty方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAddressString
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nullable
public static String getAddressString (@Nullable final IPostalAddress aAddress,
@Nonnull final List <EPostalAddressField> aFields,
@Nonnull final Locale aDisplayLocale,
@Nonnull final String sLineSeparator)
{
ValueEnforcer.notNull (aFields, "Fields");
ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale");
ValueEnforcer.notNull (sLineSeparator, "LineSeparator");
if (aAddress == null)
return null;
final ICommonsList <String> aValues = new CommonsArrayList <> (aFields.size ());
for (final EPostalAddressField eField : aFields)
aValues.add (eField.get (aAddress, aDisplayLocale));
return StringHelper.getImplodedNonEmpty (sLineSeparator, aValues);
}
示例2: internalLog
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Override
protected void internalLog (@Nonnull final IError aResError)
{
final int nLine = aResError.getErrorLocation ().getLineNumber ();
final int nColumn = aResError.getErrorLocation ().getColumnNumber ();
final String sMessage = StringHelper.getImplodedNonEmpty (" - ",
aResError.getErrorText (Locale.US),
aResError.getLinkedExceptionMessage ());
// 0 means undefined line/column
buildContext.addMessage (m_aSourceFile,
nLine <= 0 ? 0 : nLine,
nColumn <= 0 ? 0 : nColumn,
sMessage,
aResError.isError () ? BuildContext.SEVERITY_ERROR : BuildContext.SEVERITY_WARNING,
aResError.getLinkedExceptionCause ());
}
示例3: FileSystemFolderTree
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
public FileSystemFolderTree (@Nonnull final File aStartDir,
@Nullable final Predicate <? super File> aDirFilter,
@Nullable final Predicate <? super File> aFileFilter)
{
super (x -> StringHelper.getImplodedNonEmpty ('/', x));
ValueEnforcer.notNull (aStartDir, "StartDirectory");
ValueEnforcer.isTrue (aStartDir.isDirectory (), "Start directory is not a directory!");
final DefaultFolderTreeItem <String, File, ICommonsList <File>> aStart = getRootItem ().createChildItem (aStartDir.getName (),
new CommonsArrayList <> ());
_iterate (aStart, aStartDir, aDirFilter, aFileFilter);
}
示例4: testGetStringCombinatorWithSeparatorIgnoreEmptyChar
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Test
public void testGetStringCombinatorWithSeparatorIgnoreEmptyChar ()
{
final IAggregator <String, String> c = x -> StringHelper.getImplodedNonEmpty (',', x);
assertEquals ("a,b", c.apply ("a", "b"));
assertEquals ("a", c.apply ("a", null));
assertEquals ("b", c.apply (null, "b"));
assertEquals ("", c.apply (null, null));
assertEquals ("", c.apply ("", ""));
}
示例5: testGetStringCombinatorWithSeparatorIgnoreEmptyString
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Test
public void testGetStringCombinatorWithSeparatorIgnoreEmptyString ()
{
final IAggregator <String, String> c = x -> StringHelper.getImplodedNonEmpty (";", x);
assertEquals ("a;b", c.apply ("a", "b"));
assertEquals ("a", c.apply ("a", null));
assertEquals ("b", c.apply (null, "b"));
assertEquals ("", c.apply (null, null));
assertEquals ("", c.apply ("", ""));
}
示例6: getStreetAndBuildingNumber
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nullable
public static String getStreetAndBuildingNumber (@Nullable final IPostalAddress aAddress)
{
if (aAddress == null)
return null;
return StringHelper.getImplodedNonEmpty (' ', aAddress.getStreet (), aAddress.getBuildingNumber ());
}
示例7: getPostalCodeAndCity
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nullable
public static String getPostalCodeAndCity (@Nullable final IPostalAddress aAddress)
{
if (aAddress == null)
return null;
return StringHelper.getImplodedNonEmpty (' ', aAddress.getPostalCode (), aAddress.getCity ());
}
示例8: getAsCompleteDisplayNameFirstNameFirst
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nonnull
public static String getAsCompleteDisplayNameFirstNameFirst (@Nonnull final IPersonName aName)
{
// Concatenate all non-empty parts
return StringHelper.getImplodedNonEmpty (' ',
aName.getPrefixTitle (),
aName.getFirstName (),
aName.getMiddleName (),
aName.getLastName (),
aName.getSuffixTitle ());
}
示例9: getAsCompleteDisplayNameLastNameFirst
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nonnull
public static String getAsCompleteDisplayNameLastNameFirst (@Nonnull final IPersonName aName)
{
// Concatenate all non-empty parts
return StringHelper.getImplodedNonEmpty (' ',
aName.getPrefixTitle (),
aName.getLastName (),
aName.getFirstName (),
aName.getMiddleName (),
aName.getSuffixTitle ());
}
示例10: getLogMessage
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nonnull
public static String getLogMessage (@Nullable final IReadableResource aRes,
@Nullable final IPSElement aSourceElement,
@Nonnull final String sMessage)
{
return StringHelper.getImplodedNonEmpty (" - ",
aRes == null ? null : aRes.getPath (),
aSourceElement == null ? null
: ClassHelper.getClassLocalName (aSourceElement),
aSourceElement instanceof IPSHasID &&
((IPSHasID) aSourceElement).hasID () ? "ID " + ((IPSHasID) aSourceElement).getID () : null,
sMessage);
}
示例11: getAsDisplayNameFirstNameFirst
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nonnull
public static String getAsDisplayNameFirstNameFirst (@Nonnull final IPersonName aName)
{
// Concatenate all non-empty parts
return StringHelper.getImplodedNonEmpty (' ', aName.getFirstName (), aName.getMiddleName (), aName.getLastName ());
}
示例12: getAsDisplayNameLastNameFirst
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
@Nonnull
public static String getAsDisplayNameLastNameFirst (@Nonnull final IPersonName aName)
{
// Concatenate all non-empty parts
return StringHelper.getImplodedNonEmpty (' ', aName.getLastName (), aName.getFirstName (), aName.getMiddleName ());
}
示例13: getDisplayNameAndCompanyType
import com.helger.commons.string.StringHelper; //导入方法依赖的package包/类
/**
* Get display name and company type concatenated using the provided
* separator. The separator is only used, if both fields are present and not
* empty.
*
* @param sSep
* The separator to use. May not be <code>null</code>.
* @return The non-<code>null</code> merged string.
* @see #getDisplayName()
* @see #getCompanyType()
*/
@Nonnull
default String getDisplayNameAndCompanyType (@Nonnull final String sSep)
{
return StringHelper.getImplodedNonEmpty (sSep, getDisplayName (), getCompanyType ());
}