本文整理汇总了Java中org.bridj.ann.Library.value方法的典型用法代码示例。如果您正苦于以下问题:Java Library.value方法的具体用法?Java Library.value怎么用?Java Library.value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bridj.ann.Library
的用法示例。
在下文中一共展示了Library.value方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: register
import org.bridj.ann.Library; //导入方法依赖的package包/类
@Override
public void register(Type type) {
Class<?> typeClass = Utils.getClass(type);
typeClass.getAnnotation(Library.class);
Library libAnn = typeClass.getAnnotation(Library.class);
if (libAnn != null) {
String name = libAnn.value();
File libraryFile = BridJ.getNativeLibraryFile(name);
if (libraryFile != null) {
System.load(libraryFile.toString());
}
if (ObjCObject.class.isAssignableFrom(typeClass)) {
bridjClassesByObjCName.put(typeClass.getSimpleName(), (Class<? extends ObjCObject>) typeClass);
}
}
super.register(type);
}
示例2: getNativeLibrary
import org.bridj.ann.Library; //导入方法依赖的package包/类
@Override
protected NativeLibrary getNativeLibrary(Class<?> type) throws IOException {
Library libAnn = type.getAnnotation(Library.class);
if (libAnn != null) {
try {
String name = libAnn.value();
return BridJ.getNativeLibrary(name, new File("/System/Library/Frameworks/" + name + ".framework/" + name));
} catch (FileNotFoundException ex) {
}
}
return super.getNativeLibrary(type);
}
示例3: getNativeLibrary
import org.bridj.ann.Library; //导入方法依赖的package包/类
public static synchronized NativeLibrary getNativeLibrary(AnnotatedElement type) throws IOException {
NativeLibrary lib = librariesByClass.get(type);
if (lib == null) {
Library libraryAnnotation = getLibrary(type);
if (libraryAnnotation != null) {
String libraryName = libraryAnnotation.value();
String dependenciesEnv = getDependenciesEnv(libraryName);
List<String> dependencies = libraryDependencies.get(libraryName);
List<String> staticDependencies = Arrays.asList(
dependenciesEnv == null ? libraryAnnotation.dependencies() : dependenciesEnv.split(","));
if (dependencies == null) {
dependencies = staticDependencies;
} else {
dependencies.addAll(staticDependencies);
}
for (String dependency : dependencies) {
if (verbose) {
info("Trying to load dependency '" + dependency + "' of '" + libraryName + "'");
}
NativeLibrary depLib = getNativeLibrary(dependency);
if (depLib == null) {
throw new RuntimeException("Failed to load dependency '" + dependency + "' of library '" + libraryName + "'");
}
}
lib = getNativeLibrary(libraryName);
if (lib != null) {
librariesByClass.put(type, lib);
}
}
}
return lib;
}
示例4: getNativeLibraryName
import org.bridj.ann.Library; //导入方法依赖的package包/类
/**
* Gets the name of the library declared for an annotated element. Recurses
* up to parents of the element (class, enclosing classes) to find any
* {@link org.bridj.ann.Library} annotation.
*/
public static String getNativeLibraryName(AnnotatedElement m) {
Library lib = getLibrary(m);
return lib == null ? null : lib.value();
}