本文整理汇总了Java中org.apache.tools.ant.util.StringUtils.removeSuffix方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.removeSuffix方法的具体用法?Java StringUtils.removeSuffix怎么用?Java StringUtils.removeSuffix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.util.StringUtils
的用法示例。
在下文中一共展示了StringUtils.removeSuffix方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLabel
import org.apache.tools.ant.util.StringUtils; //导入方法依赖的package包/类
public String getLabel(OWLClass cls) {
Set<OWLAnnotation> annotations = cls.getAnnotations(ont);
for (OWLAnnotation annotation : annotations) {
if (annotation.getProperty().isLabel()) {
String s = annotation.getValue().toString();
s = StringUtils.removePrefix(s, "\"");
s = StringUtils.removeSuffix(s, "\"^^xsd:string");
return s;
}
}
return null;
}
示例2: getNamespace
import org.apache.tools.ant.util.StringUtils; //导入方法依赖的package包/类
public String getNamespace(OWLClass cls) {
Set<OWLAnnotation> annotations = cls.getAnnotations(ont);
for (OWLAnnotation annotation : annotations) {
String propertyUri = getAnnotationPropertyUri(annotation);
if (propertyUri.equals(NAMESPACE_PROP_ALT) || propertyUri.equals(NAMESPACE_PROP)) {
String s = annotation.getValue().toString();
s = StringUtils.removePrefix(s, "\"");
s = StringUtils.removeSuffix(s, "\"^^xsd:string");
return s;
}
}
return null;
}
示例3: getDirectoryScanner
import org.apache.tools.ant.util.StringUtils; //导入方法依赖的package包/类
/**
* Return the DirectoryScanner associated with this FileSet.
*
* @param p the project used to resolve dirs, etc.
*
* @return a dependency scanner.
*/
@Override
public DirectoryScanner getDirectoryScanner(Project p) {
if (isReference()) {
return getRef(p).getDirectoryScanner(p);
}
dieOnCircularReference(p);
DirectoryScanner parentScanner = super.getDirectoryScanner(p);
DependScanner scanner = new DependScanner(parentScanner);
final Vector<String> allRootClasses = new Vector<>(rootClasses);
for (FileSet additionalRootSet : rootFileSets) {
DirectoryScanner additionalScanner
= additionalRootSet.getDirectoryScanner(p);
String[] files = additionalScanner.getIncludedFiles();
for (int i = 0; i < files.length; ++i) {
if (files[i].endsWith(".class")) {
String classFilePath = StringUtils.removeSuffix(files[i], ".class");
String className
= classFilePath.replace('/', '.').replace('\\', '.');
allRootClasses.addElement(className);
}
}
scanner.addBasedir(additionalRootSet.getDir(p));
}
scanner.setBasedir(getDir(p));
scanner.setRootClasses(allRootClasses);
scanner.scan();
return scanner;
}
示例4: moveGeneratedFile
import org.apache.tools.ant.util.StringUtils; //导入方法依赖的package包/类
/**
* Move the generated source file(s) to the base directory
*
* @throws org.apache.tools.ant.BuildException When error
* copying/removing files.
*/
private void moveGeneratedFile(File baseDir, File sourceBaseFile, String classname,
RmicAdapter adapter) throws BuildException {
String classFileName = classname.replace('.', File.separatorChar)
+ ".class";
String[] generatedFiles = adapter.getMapper().mapFileName(classFileName);
for (String generatedFile : generatedFiles) {
if (!generatedFile.endsWith(".class")) {
// don't know how to handle that - a IDL file doesn't
// have a corresponding Java source for example.
continue;
}
String sourceFileName =
StringUtils.removeSuffix(generatedFile, ".class") + ".java";
File oldFile = new File(baseDir, sourceFileName);
if (!oldFile.exists()) {
// no source file generated, nothing to move
continue;
}
File newFile = new File(sourceBaseFile, sourceFileName);
try {
if (filtering) {
FILE_UTILS.copyFile(oldFile, newFile,
new FilterSetCollection(getProject()
.getGlobalFilterSet()));
} else {
FILE_UTILS.copyFile(oldFile, newFile);
}
oldFile.delete();
} catch (IOException ioe) {
throw new BuildException("Failed to copy " + oldFile + " to "
+ newFile + " due to " + ioe.getMessage(), ioe,
getLocation());
}
}
}
示例5: stripExtension
import org.apache.tools.ant.util.StringUtils; //导入方法依赖的package包/类
/**
* get short filename from file
*
* @param jspFile file in
* @return file without any jsp extension
*/
private String stripExtension(File jspFile) {
return StringUtils.removeSuffix(jspFile.getName(), ".jsp");
}