本文整理汇总了Java中org.openrdf.annotations.Iri类的典型用法代码示例。如果您正苦于以下问题:Java Iri类的具体用法?Java Iri怎么用?Java Iri使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Iri类属于org.openrdf.annotations包,在下文中一共展示了Iri类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDeclaringJavaClazz
import org.openrdf.annotations.Iri; //导入依赖的package包/类
/**
* Returns the Java resource object that is declaring a method or a field.
* If the given object is a method the resource object it is declared in is returned.
* If the given object is a field that is declared in a {@link Partial} class then
* the resource object superinterface is returned.
* @param object The object which declaring class to get.
* @return Returns the class that is declaring the given object or null if the given object
* is neither a method nor a field or if no resource object interface is found.
*/
private Class<?> getDeclaringJavaClazz(AccessibleObject object) {
if(object instanceof Method) {
return ((Method) object).getDeclaringClass();
} else if(object instanceof Field) {
Class<?> declaringClass = ((Field) object).getDeclaringClass();
if (declaringClass.isAnnotationPresent(Partial.class)) {
for(Class<?> iface : declaringClass.getInterfaces()) {
if (iface.isAnnotationPresent(Iri.class)) {
return iface;
}
}
return null;
} else {
return null;
}
} else {
return null;
}
}
示例2: scanConceptsWithReflections
import org.openrdf.annotations.Iri; //导入依赖的package包/类
private void scanConceptsWithReflections() throws ObjectStoreConfigException {
logger.debug("Search for concepts with reflections");
Set<URL> classpath = new HashSet<>();
classpath.addAll(ClasspathHelper.forClassLoader());
classpath.addAll(ClasspathHelper.forJavaClassPath());
classpath.addAll(ClasspathHelper.forManifest());
classpath.addAll(ClasspathHelper.forPackage(""));
Reflections reflections = new Reflections(new ConfigurationBuilder()
.setUrls(classpath)
.useParallelExecutor()
.filterInputsBy(FilterBuilder.parsePackages("-java, -javax, -sun, -com.sun"))
.setScanners(new SubTypesScanner(), new TypeAnnotationsScanner()));
Set<Class<?>> annotated = reflections.getTypesAnnotatedWith(Iri.class, true);
logger.debug("Search for concepts with reflections resulted in " + annotated.size() + " classes");
for (Class clazz : annotated) {
logger.debug("Found concept class: " + clazz.getCanonicalName());
roleMapper.addConcept(clazz);
}
}
示例3: findInterfaceMethod
import org.openrdf.annotations.Iri; //导入依赖的package包/类
private Method findInterfaceMethod(Class<?>[] interfaces, String name,
Class<?> type, Class<?>[] types) {
Collection<Method> methods = findInterfaceMethods(interfaces, name, type, types);
Collection<Method> withIdentifiers = new LinkedHashSet<Method>();
for (Method m : methods) {
Annotation[][] anns = m.getParameterAnnotations();
for (int i = 0; i < anns.length; i++) {
for (int j = 0; j < anns[i].length; j++) {
if (anns[i][j].annotationType().equals(Iri.class)) {
withIdentifiers.add(m); // parameter IRI present
}
}
}
}
if (withIdentifiers.isEmpty())
return findSubMethod(methods);
return findSubMethod(withIdentifiers);
}
示例4: createAdvice
import org.openrdf.annotations.Iri; //导入依赖的package包/类
@Override
public Advice createAdvice(final Method method) {
return new Advice() {
@Override
public Object intercept(ObjectMessage message) throws Exception {
String iri = method.getAnnotation(Iri.class).value();
if (iri.equals(override))
return true;
return message.proceed();
}
};
}
示例5: isImplementationPresent
import org.openrdf.annotations.Iri; //导入依赖的package包/类
private boolean isImplementationPresent(Class<?> type, String iri, Set<Class<?>> ignore) {
if (type == null || ignore.contains(type))
return false;
Iri id = type.getAnnotation(Iri.class);
if (id != null && iri.equals(id.value()))
return true;
for (Class<?> face : type.getInterfaces()) {
if (isImplementationPresent(face, iri, ignore))
return true;
}
return isImplementationPresent(type.getSuperclass(), iri, ignore);
}
示例6: findPredicate
import org.openrdf.annotations.Iri; //导入依赖的package包/类
public String findPredicate(PropertyDescriptor pd) {
Method method = pd.getReadMethod();
Class<?> dc = method.getDeclaringClass();
String key = dc.getName() + "." + getPropertyName(method);
if (properties.containsKey(key))
return (String) properties.get(key);
Method getter = method;
Iri rdf = getter.getAnnotation(Iri.class);
if (rdf == null)
return null;
return rdf.value();
}
示例7: isAnnotationPresent
import org.openrdf.annotations.Iri; //导入依赖的package包/类
private boolean isAnnotationPresent(Class<?> clazz) {
for (Annotation ann : clazz.getAnnotations()) {
String name = ann.annotationType().getName();
if (Iri.class.getName().equals(name))
return true;
if (Matching.class.getName().equals(name))
return true;
}
return false;
}
示例8: packageInfo
import org.openrdf.annotations.Iri; //导入依赖的package包/类
private void packageInfo(String namespace, JavaMessageBuilder builder)
throws ObjectStoreConfigException {
builder.comment(this);
builder.annotationProperties(this);
builder.annotateString(Prefix.class.getName(), "value", builder
.getMemberPrefix(namespace));
builder.annotateString(Iri.class.getName(), "value", namespace);
builder.pkg(builder.getPackageName(new URIImpl(namespace)));
}
示例9: getMinCardinality
import org.openrdf.annotations.Iri; //导入依赖的package包/类
@Iri(OWL.MIN_CARDINALITY)
Set<Number> getMinCardinality();
示例10: getFormat
import org.openrdf.annotations.Iri; //导入依赖的package包/类
@Iri(DC.FORMAT)
public abstract String getFormat();
示例11: getAnotherValue
import org.openrdf.annotations.Iri; //导入依赖的package包/类
@Iri("http://www.example.com/schema#logicalTestAnotherValue")
String getAnotherValue();
示例12: setValue
import org.openrdf.annotations.Iri; //导入依赖的package包/类
@Iri(RDF.VALUE)
void setValue(String value);
示例13:
import org.openrdf.annotations.Iri; //导入依赖的package包/类
@Iri("http://example.de/inverseof_2")
Set<TestResource> getInverseOf2();
示例14: getMaxCardinality
import org.openrdf.annotations.Iri; //导入依赖的package包/类
@Iri(OWL.MAX_CARDINALITY)
Set<Number> getMaxCardinality();
示例15: getClassName
import org.openrdf.annotations.Iri; //导入依赖的package包/类
@Iri("urn:test:className")
String getClassName();