本文整理汇总了Java中com.helger.commons.functional.ISupplier类的典型用法代码示例。如果您正苦于以下问题:Java ISupplier类的具体用法?Java ISupplier怎么用?Java ISupplier使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ISupplier类属于com.helger.commons.functional包,在下文中一共展示了ISupplier类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetNewInstanceFactory
import com.helger.commons.functional.ISupplier; //导入依赖的package包/类
@Test
public void testGetNewInstanceFactory ()
{
// test with a valid class
ISupplier <?> aFactory = FactoryNewInstance.create (FactoryNewInstanceTest.class);
assertNotNull (aFactory);
assertNotNull (aFactory.get ());
// null parameter
aFactory = FactoryNewInstance.create ((Class <Object>) null);
assertNotNull (aFactory);
assertNull (aFactory.get ());
// class is abstract -> cannot create instance
aFactory = FactoryNewInstance.create (AbstractClass.class);
assertNotNull (aFactory);
assertNull (aFactory.get ());
// class has no default constructor -> cannot create instance
aFactory = FactoryNewInstance.create (ClassWithoutDefaultCtor.class);
assertNotNull (aFactory);
assertNull (aFactory.get ());
}
示例2: AS4Profile
import com.helger.commons.functional.ISupplier; //导入依赖的package包/类
public AS4Profile (@Nonnull @Nonempty final String sID,
@Nonnull @Nonempty final String sDisplayName,
@Nonnull final ISupplier <? extends IAS4ProfileValidator> aProfileValidatorProvider,
@Nonnull final ISupplier <? extends PMode> aDefaultPModeProvider,
@Nonnull final IPModeIDProvider aPModeIDProvider)
{
m_sID = ValueEnforcer.notEmpty (sID, "ID");
m_sDisplayName = ValueEnforcer.notEmpty (sDisplayName, "DisplayName");
m_aProfileValidatorProvider = ValueEnforcer.notNull (aProfileValidatorProvider, "ProfileValidatorProvider");
m_aDefaultPModeProvider = ValueEnforcer.notNull (aDefaultPModeProvider, "aDefaultPModeProvider");
m_aPModeIDProvider = ValueEnforcer.notNull (aPModeIDProvider, "PModeIDProvider");
}
示例3: ObjectPool
import com.helger.commons.functional.ISupplier; //导入依赖的package包/类
/**
* Create a new object pool for a certain amount of items and a factory that
* creates the objects on demand.
*
* @param nItemCount
* The number of items in the pool. Must be ≥ 1.
* @param aFactory
* The factory to create object. May not be <code>null</code>. The
* factory may not create <code>null</code> objects, as this leads to
* an error!
*/
public ObjectPool (@Nonnegative final int nItemCount, @Nonnull final ISupplier <? extends DATATYPE> aFactory)
{
ValueEnforcer.isGT0 (nItemCount, "ItemCount");
ValueEnforcer.notNull (aFactory, "Factory");
m_aAvailable = new Semaphore (nItemCount);
m_aItems = new Object [nItemCount];
m_aUsed = new boolean [nItemCount];
Arrays.fill (m_aUsed, 0, nItemCount, false);
m_aFactory = aFactory;
}
示例4: getMessageIDFactory
import com.helger.commons.functional.ISupplier; //导入依赖的package包/类
@Nonnull
public ISupplier <String> getMessageIDFactory ()
{
return m_aMessageIDFactory;
}
示例5: getFactory
import com.helger.commons.functional.ISupplier; //导入依赖的package包/类
/**
* @return The factory for filling missing values as provided in the
* constructor.
*/
@Nonnull
public ISupplier <? extends ELEMENTTYPE> getFactory ()
{
return m_aFactory;
}
示例6: getFilenameProvider
import com.helger.commons.functional.ISupplier; //导入依赖的package包/类
/**
* @return The filename provider used internally to build filenames. Never
* <code>null</code>.
*/
@Nonnull
public final ISupplier <String> getFilenameProvider ()
{
return m_aFilenameProvider;
}
示例7: AbstractSimpleDAO
import com.helger.commons.functional.ISupplier; //导入依赖的package包/类
protected AbstractSimpleDAO (@Nonnull final IFileRelativeIO aIO, @Nonnull final ISupplier <String> aFilenameProvider)
{
m_aIO = ValueEnforcer.notNull (aIO, "IO");
m_aFilenameProvider = ValueEnforcer.notNull (aFilenameProvider, "FilenameProvider");
}
示例8: HasInputStream
import com.helger.commons.functional.ISupplier; //导入依赖的package包/类
public HasInputStream (@Nonnull final ISupplier <? extends InputStream> aISP, final boolean bReadMultiple)
{
m_aISP = ValueEnforcer.notNull (aISP, "ISP");
m_bReadMultiple = bReadMultiple;
}
示例9: multiple
import com.helger.commons.functional.ISupplier; //导入依赖的package包/类
@Nonnull
@ReturnsMutableCopy
public static HasInputStream multiple (@Nonnull final ISupplier <? extends InputStream> aISP)
{
return new HasInputStream (aISP, true);
}
示例10: once
import com.helger.commons.functional.ISupplier; //导入依赖的package包/类
@Nonnull
@ReturnsMutableCopy
public static HasInputStream once (@Nonnull final ISupplier <? extends InputStream> aISP)
{
return new HasInputStream (aISP, false);
}
示例11: setAS2ClientFactory
import com.helger.commons.functional.ISupplier; //导入依赖的package包/类
/**
* Set the factory to create {@link AS2Client} objects internally. Overwrite
* this if you need a proxy in the AS2Client object. By default a new instance
* of AS2Client is created so you don't need to call this method.
*
* @param aAS2ClientFactory
* The factory to be used. May not be <code>null</code>.
* @return this for chaining
*/
@Nonnull
public AS2ClientBuilder setAS2ClientFactory (@Nonnull final ISupplier <AS2Client> aAS2ClientFactory)
{
m_aAS2ClientFactory = ValueEnforcer.notNull (aAS2ClientFactory, "AS2ClientFactory");
return this;
}
示例12: setMessageIDFactory
import com.helger.commons.functional.ISupplier; //导入依赖的package包/类
/**
* Set the factory that creates message IDs. By default a random UUID is used.
*
* @param aMessageIDFactory
* Factory to be used. May not be <code>null</code>.
*/
public void setMessageIDFactory (@Nonnull final ISupplier <String> aMessageIDFactory)
{
ValueEnforcer.notNull (aMessageIDFactory, "MessageIDFactory");
m_aMessageIDFactory = aMessageIDFactory;
}
示例13: SafeVector
import com.helger.commons.functional.ISupplier; //导入依赖的package包/类
/**
* Constructor with a custom factory to fill the missing elements.
*
* @param aFactory
* The factory to use. May not be <code>null</code>.
*/
public SafeVector (@Nonnull final ISupplier <? extends ELEMENTTYPE> aFactory)
{
m_aFactory = ValueEnforcer.notNull (aFactory, "Factory");
}
示例14: SafeArrayList
import com.helger.commons.functional.ISupplier; //导入依赖的package包/类
/**
* Constructor with a custom factory to fill the missing elements.
*
* @param aFactory
* The factory to use. May not be <code>null</code>.
*/
public SafeArrayList (@Nonnull final ISupplier <? extends ELEMENTTYPE> aFactory)
{
m_aFactory = ValueEnforcer.notNull (aFactory, "Factory");
}