本文整理了Java中org.ff4j.utils.Util
类的一些代码示例,展示了Util
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util
类的具体详情如下:
包路径:org.ff4j.utils.Util
类名称:Util
[英]Tips and tricks to be less verbose.
[中]小贴士和小窍门不要太冗长。
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public boolean existProperty(String name) {
Util.assertHasLength(name);
return properties.containsKey(name);
}
代码示例来源: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 boolean matchAction(String action) {
return (actionFilters.isEmpty()) || (Util.hasLength(action) && actionFilters.contains(action));
}
代码示例来源:origin: ff4j/ff4j
public static void assertEvent(Event evt) {
assertNotNull(evt);
assertHasLength(evt.getName());
assertHasLength(evt.getType());
assertHasLength(evt.getAction());
}
代码示例来源:origin: ff4j/ff4j
/**
* Put authentication header if relevant.
*
* @param webTarget
* @param auth
* @return
*/
public static Invocation.Builder createRequest(WebTarget webTarget, String auth, MediaType mediaType) {
Util.assertNotNull(webTarget);
Invocation.Builder invocationBuilder = null;
if (mediaType != null) {
invocationBuilder = webTarget.request();
} else {
invocationBuilder = webTarget.request(mediaType);
}
if (Util.hasLength(auth)) {
invocationBuilder.header(HEADER_AUTHORIZATION, auth);
}
return invocationBuilder;
}
代码示例来源:origin: ff4j/ff4j
Util.assertParamHasNotNull(mode, "ElasticConnectionMode");
Util.assertParamHasNotNull(indexName, "indexName");
Util.assertParamHasNotNull(url, "url");
this.indexName = indexName;
this.connectionMode = mode;
this.urlSet = Util.set(url);
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public boolean existProperty(String name) {
Util.assertParamHasLength(name, "Property name");
return wrapper.getCacheProperties().get(name) != null;
}
代码示例来源:origin: ff4j/ff4j
Util.assertEvent(evt);
if (Util.hasLength(evt.getUser())) {
sb.append(", EVT_USER");
statementParams.put(idx, evt.getUser());
idx++;
if (Util.hasLength(evt.getValue())) {
sb.append(", EVT_VALUE");
statementParams.put(idx, evt.getValue());
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void createSchema() {
conn.createTable(FEATURES_TABLENAME_ID, Util.set(FEATURES_CF_CORE, FEATURES_CF_PROPERTIES));
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public boolean saveEvent(Event evt) {
Util.assertEvent(evt);
executePutCommand(MAPPER.toStore(evt));
return true;
}
代码示例来源:origin: ff4j/ff4j
if (!Util.hasLength(alterBean) && !Util.isValidClass(alterClazz) && !isFeatureToggled) {
return null;
if (Util.hasLength(alterBean)
if (Util.isValidClass(alterClazz)
代码示例来源:origin: ff4j/ff4j
/**
* Substitution of PropertyXXX intoPrimitive.
*
* Allows to TODO
* @param pType
* @return
*/
public static String mapSimpleType(String className) {
if (className == null) return className;
if (PROPERTY_TYPES.containsValue(className)) {
return Util.getFirstKeyByValue(PROPERTY_TYPES, className);
}
return className;
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public boolean exist(String uid) {
Util.assertParamHasLength(uid, "Feature identifier");
return getCache().get(uid) != null;
}
代码示例来源: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());
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void createSchema() {
conn.createTable(AUDIT_TABLENAME_ID, Util.set(AUDIT_CF));
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public boolean saveEvent(Event e) {
Util.assertEvent(e);
if (EventConstants.ACTION_CHECK_OK.equalsIgnoreCase(e.getAction())) {
return saveEvent(e, featureUsageEvents);
} else if (EventConstants.ACTION_CHECK_OFF.equalsIgnoreCase(e.getAction())) {
return saveEvent(e, checkOffEvents);
}
String key = getKeyDate(e.getTimestamp());
if (!auditTrailEvents.containsKey(key)) {
auditTrailEvents.put(key, new EventSeries(this.queueCapacity));
}
return auditTrailEvents.get(key).add(e);
}
代码示例来源:origin: ff4j/ff4j
sb.append(Util.getFirstKeyByValue(uxTypes, currentProperty.getType()));
} else {
sb.append(currentProperty.getType());
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public boolean existGroup(String groupName) {
assertHasLength(groupName);
return featureGroups.containsKey(groupName);
}
代码示例来源: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 boolean matchSource(String source) {
return (sourceFilters.isEmpty()) || (Util.hasLength(source) && sourceFilters.contains(source));
}
内容来源于网络,如有侵权,请联系作者删除!