本文整理了Java中org.apache.cayenne.util.Util.isEmptyString()
方法的一些代码示例,展示了Util.isEmptyString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.isEmptyString()
方法的具体详情如下:
包路径:org.apache.cayenne.util.Util
类名称:Util
方法名:isEmptyString
[英]Returns true, if the String is null or an empty string.
[中]如果字符串为null或空字符串,则返回true。
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
public String getColumnName(int column) {
// per CAY-513 - if an empty string is passed for header, table header will
// have zero height on Windows... So we have to check for this condition
return Util.isEmptyString(headers[column]) ? " " : headers[column];
}
代码示例来源:origin: org.apache.cayenne/cayenne-server
/**
*
* @return package + "." + name when it is possible otherwise just name
*
* @since 4.0
*/
public static String getNameWithPackage(String pack, String name) {
if (Util.isEmptyString(pack)) {
return name;
} else {
return pack + (pack.endsWith(".") ? "" : ".") + name;
}
}
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
public File getFile() {
String value = fileName.getText();
if (Util.isEmptyString(value)) {
return null;
}
File file = new File(value);
if (existingOnly && !file.exists()) {
return null;
}
return file;
}
代码示例来源:origin: org.apache.cayenne/cayenne-nodeps
String buildExceptionMessage(String message, Throwable th) {
StringBuffer buffer = new StringBuffer(message);
buffer.append(". URL - ").append(url);
String thMessage = th.getMessage();
if (!Util.isEmptyString(thMessage)) {
buffer.append("; CAUSE - ").append(thMessage);
}
return buffer.toString();
}
代码示例来源:origin: org.apache.cayenne/cayenne-server
/**
* Configures an "extra" path that will resolve to an extra column (or columns) in the
* result set.
*
* @param path A valid path expression. E.g. "abc" or "db:ABC" or "abc.xyz".
* @since 1.2
*/
public void addResultPath(String path) {
if (Util.isEmptyString(path)) {
throw new IllegalArgumentException("Invalid path: " + path);
}
nonNullResultPaths().add(path);
}
代码示例来源:origin: org.apache.cayenne/cayenne-nodeps
/**
* Configures an "extra" path that will resolve to an extra column (or columns) in the
* result set.
*
* @param path A valid path expression. E.g. "abc" or "db:ABC" or "abc.xyz".
* @since 1.2
*/
public void addResultPath(String path) {
if (Util.isEmptyString(path)) {
throw new IllegalArgumentException("Invalid path: " + path);
}
nonNullResultPaths().add(path);
}
代码示例来源:origin: org.apache.cayenne/cayenne-nodeps
/**
* Decodes the String (assuming it is using Base64 encoding), and then deserializes
* object from the byte array.
*/
static Object deserializeFromString(String string) throws Exception {
if (Util.isEmptyString(string)) {
return null;
}
byte[] bytes = Base64Codec.decodeBase64(string.getBytes());
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
Object object = in.readObject();
in.close();
return object;
}
代码示例来源:origin: org.apache.cayenne/cayenne-server
/**
* Looks up an existing node in the tree desribed by the dot-separated path.
* Will return null if no matching child exists.
*/
public PrefetchTreeNode getNode(String path) {
if (Util.isEmptyString(path)) {
throw new IllegalArgumentException("Empty path: " + path);
}
PrefetchTreeNode node = this;
StringTokenizer toks = new StringTokenizer(path, Entity.PATH_SEPARATOR);
while (toks.hasMoreTokens() && node != null) {
String segment = toks.nextToken();
node = node.getChild(segment);
}
return node;
}
代码示例来源:origin: org.apache.cayenne/cayenne-nodeps
protected void validateConnection(DataNode node, ProjectPath path, Validator validator) {
String factory = node.getDataSourceFactory();
// If direct factory, make sure the location is a valid file name.
if (Util.isEmptyString(factory)) {
validator.registerError("No DataSource factory.", path);
}
else if (!DriverDataSourceFactory.class.getName().equals(factory)) {
String location = node.getDataSourceLocation();
if (Util.isEmptyString(location)) {
validator.registerError("DataNode has no location parameter.", path);
}
}
}
代码示例来源:origin: org.apache.cayenne/cayenne-project
void validateDefaultSQL(SQLTemplateDescriptor query, ValidationResult validationResult) {
if (Util.isEmptyString(query.getSql())) {
// see if there is at least one adapter-specific template...
for (Map.Entry<String, String> entry : query.getAdapterSql().entrySet()) {
if (!Util.isEmptyString(entry.getValue())) {
return;
}
}
addFailure(
validationResult,
query,
"SQLTemplate query '%s' has no default SQL template",
query.getName());
}
}
代码示例来源:origin: org.apache.cayenne/cayenne-nodeps
protected void validateDefaultSQL(
SQLTemplate query,
ProjectPath path,
Validator validator) {
if (Util.isEmptyString(query.getDefaultTemplate())) {
// see if there is at least one adapter-specific template...
Iterator it = query.getTemplateKeys().iterator();
while (it.hasNext()) {
String key = (String) it.next();
if (!Util.isEmptyString(query.getCustomTemplate(key))) {
return;
}
}
validator.registerWarning("Query has no default SQL template", path);
}
}
代码示例来源:origin: org.apache.cayenne/cayenne-project
void validate(DataChannelDescriptor domain, ValidationResult validationResult) {
String name = domain.getName();
if (Util.isEmptyString(name)) {
addFailure(validationResult, domain, "Unnamed DataDomain");
}
}
}
代码示例来源:origin: org.apache.cayenne/cayenne-project
void validateConnection(DataNodeDescriptor node, ValidationResult validationResult) {
String factory = node.getDataSourceFactoryType();
// TODO: andrus 03/10/2010 - null factory is allowed, however
// 'getDataSourceDescriptor' must ne not null in this case
if (factory != null
&& !XMLPoolingDataSourceFactory.class.getName().equals(factory)) {
String parameters = node.getParameters();
if (Util.isEmptyString(parameters)) {
addFailure(
validationResult,
node,
"DataNode has empty 'parameters' string");
}
}
}
代码示例来源:origin: org.apache.cayenne/cayenne-nodeps
public void addChild(PrefetchTreeNode child) {
if (Util.isEmptyString(child.getName())) {
throw new IllegalArgumentException("Child has no segmentPath: " + child);
}
if (child.getParent() != this) {
child.getParent().removeChild(child.getName());
child.parent = this;
}
if (children == null) {
children = new ArrayList(4);
}
children.add(child);
}
代码示例来源:origin: org.apache.cayenne/cayenne-server
public void addChild(PrefetchTreeNode child) {
if (Util.isEmptyString(child.getName())) {
throw new IllegalArgumentException("Child has no segmentPath: " + child);
}
if (child.getParent() != this) {
child.getParent().removeChild(child.getName());
child.parent = this;
}
if (children == null) {
children = new ArrayList<>(4);
}
children.add(child);
}
代码示例来源:origin: org.apache.cayenne/cayenne-project
void validate(EmbeddableAttribute attribute, ValidationResult validationResult) {
// Must have name
if (Util.isEmptyString(attribute.getName())) {
addFailure(validationResult, attribute, "Unnamed EmbeddableAttribute");
}
// all attributes must have type
if (Util.isEmptyString(attribute.getType())) {
addFailure(
validationResult,
attribute,
"EmbeddableAttribute '%s' has no type",
attribute.getName());
}
}
}
代码示例来源:origin: org.apache.cayenne/cayenne-project
private void validateJavaPackage(DataMap map, ValidationResult validationResult) {
String javaPackage = map.getDefaultPackage();
if(Util.isEmptyString(javaPackage)) {
addFailure(validationResult, map, "Java package is not set in DataMap '%s'", map.getName());
return;
}
NameValidationHelper helper = NameValidationHelper.getInstance();
String invalidChars = helper.invalidCharsInJavaClassName(javaPackage);
if(invalidChars != null) {
addFailure(validationResult, map, "DataMap '%s' Java package '%s' contains invalid characters: %s",
map.getName(), javaPackage, invalidChars);
}
}
}
代码示例来源:origin: org.apache.cayenne/cayenne-project
void validate(ObjAttribute attribute, ValidationResult validationResult) {
validateName(attribute, validationResult);
// all attributes must have type
if (Util.isEmptyString(attribute.getType())) {
addFailure(validationResult, attribute,
"ObjAttribute '%s' has no Java type",
attribute.getName());
}
if (attribute instanceof EmbeddedAttribute) {
validateEmbeddable((EmbeddedAttribute)attribute, validationResult);
} else {
validateDbAttribute(attribute, validationResult);
}
checkForDuplicates(attribute, validationResult);
checkSuperEntityAttributes(attribute, validationResult);
}
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
protected void initBindings() {
// bind actions
BindingBuilder builder = new BindingBuilder(
getApplication().getBindingFactory(),
this);
CayenneProjectPreferences cayPrPref = application.getCayenneProjectPreferences();
this.preferences = (PreferenceDetail) cayPrPref.getProjectDetailObject(
PreferenceDetail.class,
getViewPreferences().node("controller"));
if (Util.isEmptyString(preferences.getProperty("mode"))) {
preferences.setProperty("mode", STANDARD_OBJECTS_MODE);
}
builder.bindToComboSelection(
view.getGenerationMode(),
"preferences.property['mode']").updateView();
}
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
protected void updateSuperclass() {
boolean doAll = isAllEntities();
String defaultSuperclass = getSuperclass();
for (ObjEntity entity : dataMap.getObjEntities()) {
if (doAll || Util.isEmptyString(getSuperClassName(entity))) {
if (!Util.nullSafeEquals(defaultSuperclass, getSuperClassName(entity))) {
setSuperClassName(entity, defaultSuperclass);
// any way to batch events, a big change will flood the app with
// entity events..?
mediator.fireDbEntityEvent(new EntityEvent(this, entity));
}
}
}
view.dispose();
}
内容来源于网络,如有侵权,请联系作者删除!