本文整理了Java中org.apache.commons.lang.Validate.notNull()
方法的一些代码示例,展示了Validate.notNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Validate.notNull()
方法的具体详情如下:
包路径:org.apache.commons.lang.Validate
类名称:Validate
方法名:notNull
[英]Validate that the specified argument is not null
; otherwise throwing an exception.
Validate.notNull(myObject);
The message of the exception is "The validated object is null".
[中]验证指定的参数不是null
;否则将引发异常。
Validate.notNull(myObject);
异常的消息是“已验证的对象为空”。
代码示例来源:origin: apache/storm
public JdbcLookupBolt(ConnectionProvider connectionProvider, String selectQuery, JdbcLookupMapper jdbcLookupMapper) {
super(connectionProvider);
Validate.notNull(selectQuery);
Validate.notNull(jdbcLookupMapper);
this.selectQuery = selectQuery;
this.jdbcLookupMapper = jdbcLookupMapper;
}
代码示例来源:origin: apache/storm
public HBaseLookupBolt(String tableName, HBaseMapper mapper, HBaseValueMapper rowToTupleMapper) {
super(tableName, mapper);
Validate.notNull(rowToTupleMapper, "rowToTupleMapper can not be null");
this.rowToTupleMapper = rowToTupleMapper;
}
代码示例来源:origin: apache/storm
/**
* MongoInsertBolt Constructor.
* @param url The MongoDB server url
* @param collectionName The collection where reading/writing data
* @param mapper MongoMapper converting tuple to an MongoDB document
*/
public MongoInsertBolt(String url, String collectionName, MongoMapper mapper) {
super(url, collectionName);
Validate.notNull(mapper, "MongoMapper can not be null");
this.mapper = mapper;
}
代码示例来源:origin: apache/storm
public JdbcInsertBolt(ConnectionProvider connectionProvider, JdbcMapper jdbcMapper) {
super(connectionProvider);
Validate.notNull(jdbcMapper);
this.jdbcMapper = jdbcMapper;
}
代码示例来源:origin: apache/storm
/**
* Constructor.
* <p/>
* @param connectionProviderParam database connection provider
*/
public AbstractJdbcBolt(final ConnectionProvider connectionProviderParam) {
Validate.notNull(connectionProviderParam);
this.connectionProvider = connectionProviderParam;
}
代码示例来源:origin: commons-lang/commons-lang
/**
* <p>Validate that the specified argument is not <code>null</code>;
* otherwise throwing an exception.
*
* <pre>Validate.notNull(myObject);</pre>
*
* <p>The message of the exception is "The validated object is
* null".</p>
*
* @param object the object to check
* @throws IllegalArgumentException if the object is <code>null</code>
*/
public static void notNull(Object object) {
notNull(object, "The validated object is null");
}
代码示例来源:origin: apache/storm
/**
* MongoUpdateBolt Constructor.
* @param url The MongoDB server url
* @param collectionName The collection where reading/writing data
* @param queryCreator QueryFilterCreator
* @param mapper MongoMapper converting tuple to an MongoDB document
*/
public MongoUpdateBolt(String url, String collectionName, QueryFilterCreator queryCreator, MongoUpdateMapper mapper) {
super(url, collectionName);
Validate.notNull(queryCreator, "QueryFilterCreator can not be null");
Validate.notNull(mapper, "MongoUpdateMapper can not be null");
this.queryCreator = queryCreator;
this.mapper = mapper;
}
代码示例来源:origin: apache/storm
/**
* MongoLookupBolt Constructor.
* @param url The MongoDB server url
* @param collectionName The collection where reading/writing data
* @param queryCreator QueryFilterCreator
* @param mapper MongoMapper converting tuple to an MongoDB document
*/
public MongoLookupBolt(String url, String collectionName, QueryFilterCreator queryCreator, MongoLookupMapper mapper) {
super(url, collectionName);
Validate.notNull(queryCreator, "QueryFilterCreator can not be null");
Validate.notNull(mapper, "MongoLookupMapper can not be null");
this.queryCreator = queryCreator;
this.mapper = mapper;
}
代码示例来源:origin: Bukkit/Bukkit
/**
* Sets the player that this message will display as, or command will be
* executed as
*
* @param player New player which this event will execute as
*/
public void setPlayer(final Player player) {
Validate.notNull(player, "Player cannot be null");
this.player = player;
}
代码示例来源:origin: apache/storm
public AbstractHBaseBolt(String tableName, HBaseMapper mapper) {
Validate.notEmpty(tableName, "Table name can not be blank or null");
Validate.notNull(mapper, "mapper can not be null");
this.tableName = tableName;
this.mapper = mapper;
}
代码示例来源:origin: Bukkit/Bukkit
public void addDefaults(Map<String, Object> defaults) {
Validate.notNull(defaults, "Defaults may not be null");
for (Map.Entry<String, Object> entry : defaults.entrySet()) {
addDefault(entry.getKey(), entry.getValue());
}
}
代码示例来源:origin: Bukkit/Bukkit
/**
* Sets the ItemStack being moved; if this is different from the original
* ItemStack, the original item will not be removed from the source
* inventory.
*
* @param itemStack The ItemStack
*/
public void setItem(ItemStack itemStack) {
Validate.notNull(itemStack, "ItemStack cannot be null. Cancel the event if you want nothing to be transferred.");
this.itemStack = itemStack.clone();
}
代码示例来源:origin: apache/storm
protected MongoMapState(Map<String, Object> map, Options options) {
this.options = options;
this.map = map;
this.serializer = options.serializer;
Validate.notEmpty(options.url, "url can not be blank or null");
Validate.notEmpty(options.collectionName, "collectionName can not be blank or null");
Validate.notNull(options.queryCreator, "queryCreator can not be null");
Validate.notNull(options.mapper, "mapper can not be null");
this.mongoClient = new MongoDbClient(options.url, options.collectionName);
}
代码示例来源:origin: apache/storm
protected void prepare() {
Validate.notEmpty(options.properties, "Producer properties can not be empty");
Validate.notNull(options.selector, "TopicSelector can not be null");
Validate.notNull(options.mapper, "TupleToMessageMapper can not be null");
producer = new DefaultMQProducer();
producer.setInstanceName(UUID.randomUUID().toString());
RocketMqConfig.buildProducerConfigs(options.properties, producer);
try {
producer.start();
} catch (MQClientException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: Bukkit/Bukkit
public PlayerEditBookEvent(Player who, int slot, BookMeta previousBookMeta, BookMeta newBookMeta, boolean isSigning) {
super(who);
Validate.isTrue(slot >= 0 && slot <=8, "Slot must be in range 0-8 inclusive");
Validate.notNull(previousBookMeta, "Previous book meta must not be null");
Validate.notNull(newBookMeta, "New book meta must not be null");
Bukkit.getItemFactory().equals(previousBookMeta, newBookMeta);
this.previousBookMeta = previousBookMeta;
this.newBookMeta = newBookMeta;
this.slot = slot;
this.isSigning = isSigning;
this.cancel = false;
}
代码示例来源:origin: apache/storm
@Override
public void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) {
Validate.notEmpty(properties, "Producer properties can not be empty");
Validate.notNull(selector, "TopicSelector can not be null");
Validate.notNull(mapper, "TupleToMessageMapper can not be null");
producer = new DefaultMQProducer();
producer.setInstanceName(String.valueOf(context.getThisTaskId()));
RocketMqConfig.buildProducerConfigs(properties, producer);
try {
producer.start();
} catch (MQClientException e) {
throw new RuntimeException(e);
}
this.collector = collector;
this.batchHelper = new BatchHelper(batchSize, collector);
this.messages = new LinkedList<>();
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* @param keyStorePassword
* the keyStorePassword to set
*/
public void setKeyStorePassword( String keyStorePassword ) {
Validate.notNull( keyStorePassword, BaseMessages.getString( PKG, "WebServer.Error.IllegalSslParameter",
XML_TAG_KEY_STORE_PASSWORD, NULL ) );
Validate.notEmpty( keyStorePassword, BaseMessages.getString( PKG, "WebServer.Error.IllegalSslParameter",
XML_TAG_KEY_STORE_PASSWORD, EMPTY ) );
this.keyStorePassword = keyStorePassword;
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* @param keyStorePath
* the keyStorePath to set
*/
public void setKeyStore( String keyStore ) {
Validate.notNull( keyStore, BaseMessages.getString( PKG, "WebServer.Error.IllegalSslParameter", XML_TAG_KEY_STORE,
NULL ) );
Validate.notEmpty( keyStore, BaseMessages.getString( PKG, "WebServer.Error.IllegalSslParameter", XML_TAG_KEY_STORE,
EMPTY ) );
this.keyStore = keyStore;
}
代码示例来源:origin: apache/storm
public SimpleJdbcMapper(String tableName, ConnectionProvider connectionProvider) {
Validate.notEmpty(tableName);
Validate.notNull(connectionProvider);
int queryTimeoutSecs = 30;
connectionProvider.prepare();
JdbcClient client = new JdbcClient(connectionProvider, queryTimeoutSecs);
this.schemaColumns = client.getColumnSchema(tableName);
}
代码示例来源:origin: apache/zeppelin
public static RepositorySystemSession newRepositorySystemSession(
RepositorySystem system, String localRepoPath) {
Validate.notNull(localRepoPath, "localRepoPath should have a value");
MavenRepositorySystemSession session = new MavenRepositorySystemSession();
LocalRepository localRepo = new LocalRepository(resolveLocalRepoPath(localRepoPath));
session.setLocalRepositoryManager(system.newLocalRepositoryManager(localRepo));
if (logger.isDebugEnabled()) {
session.setTransferListener(new TransferListener());
session.setRepositoryListener(new RepositoryListener());
}
// uncomment to generate dirty trees
// session.setDependencyGraphTransformer( null );
return session;
}
内容来源于网络,如有侵权,请联系作者删除!