本文整理了Java中org.ff4j.utils.Util.assertNotNull()
方法的一些代码示例,展示了Util.assertNotNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.assertNotNull()
方法的具体详情如下:
包路径:org.ff4j.utils.Util
类名称:Util
方法名:assertNotNull
[英]Check that object is not null.
[中]检查对象是否为空。
代码示例来源:origin: ff4j/ff4j
/**
* Check that object is not null.
*
* @param object
* target object
*/
public static void assertNotNull(Object... params) {
assertNotNull("parameter", params);
}
代码示例来源:origin: ff4j/ff4j
public static Object getSessionAttribute(HttpServletRequest request, String name) {
Util.assertNotNull(request);
HttpSession session = request.getSession(false);
return (session != null ? session.getAttribute(name) : null);
}
代码示例来源:origin: ff4j/ff4j
public static String getSessionId(HttpServletRequest request) {
Util.assertNotNull(request);
HttpSession session = request.getSession(false);
return (session != null ? session.getId() : null);
}
代码示例来源:origin: ff4j/ff4j
public static Cookie getCookie(HttpServletRequest request, String name) {
Util.assertNotNull(request);
Cookie cookies[] = request.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
if (name.equals(cookie.getName())) {
return cookie;
}
}
}
return null;
}
代码示例来源:origin: ff4j/ff4j
public static void setSessionAttribute(HttpServletRequest request, String name, Object value) {
Util.assertNotNull(request);
if (value != null) {
request.getSession().setAttribute(name, value);
}
else {
HttpSession session = request.getSession(false);
if (session != null) {
session.removeAttribute(name);
}
}
}
代码示例来源:origin: ff4j/ff4j
/**
* Get access to store web resource.
*
* @return target web resource
*/
private WebTarget getStore() {
Util.assertNotNull(url);
if (storeWebRsc == null) {
storeWebRsc = getJerseyClient().target(url).path(RESOURCE_STORE).path(RESOURCE_FEATURES);
}
return storeWebRsc;
}
代码示例来源:origin: ff4j/ff4j
public static void generateInterfaceConstantFile(FF4j ff4j, File folder) throws IOException {
Util.assertNotNull(folder);
File outFile = new File(folder.getAbsolutePath() + File.separator + "FF4jConstants.java");
FileWriter out = new FileWriter(outFile);
out.write(generateInterfaceConstantsSource(ff4j));
out.close();
}
代码示例来源:origin: ff4j/ff4j
/**
* Utility to add a property.
*
* @param props
*/
public <T> void addProperty(Property< T > props) {
Util.assertNotNull(props);
if (customProperties == null) {
customProperties = new LinkedHashMap<String, Property<?>>();
}
customProperties.put(props.getName(), props);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Transactional
public void update(Feature newFeature) {
Util.assertNotNull(newFeature);
delete(newFeature.getUid());
create(newFeature);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void purgeAuditTrail(EventQueryDefinition query) {
Util.assertNotNull(query);
getJdbcTemplate().update(getQueryBuilder().getPurgeAuditTrailQuery(query),
new java.sql.Timestamp(query.getFrom()),
new java.sql.Timestamp(query.getTo()));
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void purgeFeatureUsage(EventQueryDefinition query) {
Util.assertNotNull(query);
// Enforce removing events for feature usage
query.getActionFilters().add(ACTION_CHECK_OK);
getJdbcTemplate().update(
getQueryBuilder().getPurgeFeatureUsageQuery(query),
new java.sql.Timestamp(query.getFrom()),
new java.sql.Timestamp(query.getTo()));
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public <T> void updateProperty(Property<T> prop) {
Util.assertNotNull(prop);
// Delete
deleteProperty(prop.getName());
// Create
createProperty(prop);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public <T> void updateProperty(Property<T> prop) {
Util.assertNotNull(prop);
// Delete
deleteProperty(prop.getName());
// Create
createProperty(prop);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public <T> void updateProperty(Property<T> prop) {
Util.assertNotNull(prop);
// Delete
deleteProperty(prop.getName());
// Create
createProperty(prop);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public <T> void updateProperty(Property<T> prop) {
Util.assertNotNull(prop);
// Delete
deleteProperty(prop.getName());
// Create
createProperty(prop);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public <T> void updateProperty(Property<T> prop) {
Util.assertNotNull(prop);
// Delete
deleteProperty(prop.getName());
// Create
createProperty(prop);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public Property<?> readProperty(String name) {
Util.assertNotNull(name);
if (!existProperty(name)) {
throw new PropertyNotFoundException(name);
}
return getJdbcTemplate().
queryForObject(getQueryBuilder().getProperty(), PMAPPER, name);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
@Transactional
public void create(Feature fp) {
Util.assertNotNull(fp);
if (exist(fp.getUid())) {
throw new FeatureAlreadyExistException(fp.getUid());
}
createCoreFeature(fp);
createPermissions(fp);
createProperties(fp);
}
代码示例来源:origin: ff4j/ff4j
public static void assertEvent(Event evt) {
assertNotNull(evt);
assertHasLength(evt.getName());
assertHasLength(evt.getType());
assertHasLength(evt.getAction());
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public <T> void createProperty(Property<T> value) {
Util.assertNotNull(value);
Util.hasLength(value.getName());
if (existProperty(value.getName())) {
throw new PropertyAlreadyExistException(value.getName());
}
conf().addProperty(value.getName(), value.asString());
}
内容来源于网络,如有侵权,请联系作者删除!