本文整理了Java中org.ff4j.utils.Util.assertHasLength()
方法的一些代码示例,展示了Util.assertHasLength()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.assertHasLength()
方法的具体详情如下:
包路径:org.ff4j.utils.Util
类名称:Util
方法名:assertHasLength
[英]Check that string is not null
[中]检查字符串是否为空
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public boolean existProperty(String name) {
Util.assertHasLength(name);
return properties.containsKey(name);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public boolean existGroup(String groupName) {
assertHasLength(groupName);
return featureGroups.containsKey(groupName);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public boolean exist(String uid) {
assertHasLength(uid);
return featuresMap.containsKey(uid);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void clear() {
Util.assertHasLength(url);
Response cRes = ClientHttpUtils.invokePostMethod(
getJerseyClient().target(url)
.path(RESOURCE_STORE)
.path(STORE_CLEAR),authorizationHeaderValue);
if (Status.OK.getStatusCode() != cRes.getStatus()) {
throw new FeatureAccessException("Cannot clear feature store - " + cRes.getStatus());
}
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public void grantRoleOnFeature(String uid, String roleName) {
assertFeatureExist(uid);
assertHasLength(roleName);
featuresMap.get(uid).getPermissions().add(roleName);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void enable(String uid) {
Util.assertHasLength(uid);
Response cRes = ClientHttpUtils.invokePostMethod(
getStore().path(uid).path(OPERATION_ENABLE), authorizationHeaderValue);
if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) {
throw new FeatureNotFoundException(uid);
}
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public void deleteProperty(String name) {
Util.assertHasLength(name);
Response cRes = ClientHttpUtils.invokeDeleteMethod(getStore().path(name), authorization);
if (Status.NOT_FOUND.getStatusCode() == cRes.getStatus()) {
throw new PropertyNotFoundException(name);
}
if (Status.NO_CONTENT.getStatusCode() != cRes.getStatus()) {
throw new PropertyAccessException("Cannot delete property, an HTTP error " + cRes.getStatus() + OCCURED);
}
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public Event getEventByUUID(String uuid, Long timestamp) {
Util.assertHasLength(uuid);
List < Event > evts = getJdbcTemplate().query(
getQueryBuilder().getEventByUuidQuery(), EVENT_ROWMAPPER, uuid);
return (!evts.isEmpty()) ? evts.get(0) : null;
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public boolean existProperty(String name) {
Util.assertHasLength(name);
Map < String, Object > queryParameters = new HashMap<>();
queryParameters.put("name", name);
Result result = graphDb.execute(QUERY_CYPHER_EXISTS_PROPERTY, queryParameters);
Object count = null;
if (result.hasNext()) {
count = result.next().get(QUERY_CYPHER_ALIAS);
}
return (null != count) && (((long) count) > 0);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public boolean existProperty(String name) {
Util.assertHasLength(name);
return conf().containsKey(name);
}
代码示例来源:origin: ff4j/ff4j
/**
* Check that current feature does not exist.
*
* @param uid
* current feature identifier.s
*/
protected void assertPropertyNotExist(String uid) {
Util.assertHasLength(uid);
if (existProperty(uid)) {
throw new PropertyAlreadyExistException(uid);
}
}
代码示例来源:origin: ff4j/ff4j
/**
* Check that current feature does not exist.
*
* @param uid
* current feature identifier.s
*/
protected void assertFeatureNotExist(String uid) {
Util.assertHasLength(uid);
if (exist(uid)) {
throw new FeatureAlreadyExistException(uid);
}
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public boolean existProperty(String name) {
Util.assertHasLength(name);
return getPropertyBucket().exists(name);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void grantRoleOnFeature(String uid, String roleName) {
Util.assertHasLength(roleName);
assertFeatureExist(uid);
Feature f = read(uid);
f.getPermissions().add(roleName);
update(f);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void removeRoleFromFeature(String uid, String roleName) {
Util.assertHasLength(roleName);
assertFeatureExist(uid);
Feature f = read(uid);
f.getPermissions().remove(roleName);
update(f);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public boolean existProperty(String name) {
Util.assertHasLength(name);
return 1 == getPropertiesCollection().count(BUILDER.getName(name));
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void removeFromGroup(String uid, String groupName) {
Util.assertHasLength(groupName);
assertFeatureExist(uid);
Feature f = readGroup(groupName).get(uid);
if (f != null) {
f.setGroup(null);
update(f);
}
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public void deleteProperty(String name) {
Util.assertHasLength(name);
if (!existProperty(name)) {
throw new PropertyNotFoundException(name);
}
getJdbcTemplate().update(getQueryBuilder().deleteProperty(), name);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void grantRoleOnFeature(String uid, String roleName) {
assertFeatureExist(uid);
assertHasLength(roleName);
update(getQueryBuilder().addRoleToFeature(), uid, roleName);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void grantRoleOnFeature(String flipId, String roleName) {
assertFeatureExist(flipId);
Util.assertHasLength(roleName);
Feature feature = read(flipId);
feature.getPermissions().add(roleName);
getConnection().execute(getBuilder().queryUpdateFeature(feature));
}
内容来源于网络,如有侵权,请联系作者删除!