public void addAnnotation(Class<?> annotation, URI uri) { if (annotation.getDeclaredMethods().length != 1) throw new IllegalArgumentException( "Must specify annotation method if multiple methods exist: " + annotation); addAnnotation(annotation.getDeclaredMethods()[0], uri); }
public void addAnnotation(Class<?> annotation, URI uri) { if (annotation.getDeclaredMethods().length != 1) throw new IllegalArgumentException( "Must specify annotation method if multiple methods exist: " + annotation); addAnnotation(annotation.getDeclaredMethods()[0], uri); }
public void addAnnotation(Class<?> annotation) { for (Method m : annotation.getDeclaredMethods()) { if (!m.isAnnotationPresent(Iri.class)) { String msg = "@" + Iri.class.getSimpleName() + " annotation required in " + m.toGenericString(); throw new IllegalArgumentException(msg); } String uri = m.getAnnotation(Iri.class).value(); addAnnotation(m, new URIImpl(uri)); } }
public void addAnnotation(Method annotation, URI uri) { annotations.put(annotation, uri); annotationURIs.put(uri, annotation); if (annotation.isAnnotationPresent(Iri.class)) { String iri = annotation.getAnnotation(Iri.class).value(); if (!uri.stringValue().equals(iri)) { addAnnotation(annotation); } } }
public void addAnnotation(Method annotation) { if (!annotation.isAnnotationPresent(Iri.class)) throw new IllegalArgumentException("@" + Iri.class.getSimpleName() + " annotation required in " + annotation.toGenericString()); String uri = annotation.getAnnotation(Iri.class).value(); addAnnotation(annotation, new URIImpl(uri)); }
public void addAnnotation(Method annotation, URI uri) { annotations.put(annotation, uri); annotationURIs.put(uri, annotation); if (annotation.isAnnotationPresent(Iri.class)) { String iri = annotation.getAnnotation(Iri.class).value(); if (!uri.stringValue().equals(iri)) { addAnnotation(annotation); } } }
public void addAnnotation(Method annotation) { if (!annotation.isAnnotationPresent(Iri.class)) throw new IllegalArgumentException("@" + Iri.class.getSimpleName() + " annotation required in " + annotation.toGenericString()); String uri = annotation.getAnnotation(Iri.class).value(); addAnnotation(annotation, new URIImpl(uri)); }
public void addAnnotation(Class<?> annotation) { for (Method m : annotation.getDeclaredMethods()) { if (!m.isAnnotationPresent(Iri.class)) { String msg = "@" + Iri.class.getSimpleName() + " annotation required in " + m.toGenericString(); throw new IllegalArgumentException(msg); } String uri = m.getAnnotation(Iri.class).value(); addAnnotation(m, new URIImpl(uri)); } }
private boolean recordAnonymous(Class<?> role, Class<?> elm, boolean isConcept) throws ObjectStoreConfigException { boolean recorded = false; for (Annotation ann : elm.getAnnotations()) { for (Method m : ann.annotationType().getDeclaredMethods()) { try { URI name = findAnnotation(m); if (name == null && m.isAnnotationPresent(Iri.class)) { addAnnotation(m); name = findAnnotation(m); } if (name == null) continue; Object value = m.invoke(ann); recorded |= recordAnonymous(role, isConcept, name, value); } catch (Exception e) { logger.error(e.getMessage(), e); continue; } } } return recorded; }
roleMapper.addAnnotation(clazz.getMethod(mname), new URIImpl(rdf)); } else { roleMapper.addAnnotation(clazz.getMethod(mname));
private boolean recordAnonymous(Class<?> role, Class<?> elm, boolean isConcept) throws ObjectStoreConfigException { boolean recorded = false; for (Annotation ann : elm.getAnnotations()) { for (Method m : ann.annotationType().getDeclaredMethods()) { try { URI name = findAnnotation(m); if (name == null && m.isAnnotationPresent(Iri.class)) { addAnnotation(m); name = findAnnotation(m); } if (name == null) continue; Object value = m.invoke(ann); recorded |= recordAnonymous(role, isConcept, name, value); } catch (Exception e) { logger.error(e.getMessage(), e); continue; } } } return recorded; }
private void load(Properties p, ClassLoader cl, boolean concept) throws ClassNotFoundException, IOException, ObjectStoreConfigException { for (Map.Entry<Object, Object> e : p.entrySet()) { String role = (String) e.getKey(); String types = (String) e.getValue(); try { int idx = role.indexOf('#'); if (idx >= 0) { role = role.substring(0, idx); } Class<?> clazz = forName(role, true, cl); for (String rdf : types.split("\\s+")) { if (idx < 0) { recordRole(clazz, rdf, concept); } else { String mname = ((String)e.getKey()).substring(idx); if (mname.endsWith("()")) { mname.substring(0, mname.length() - 2); } roleMapper.addAnnotation(clazz.getMethod(mname), new URIImpl(rdf)); } } } catch (ClassNotFoundException exc) { logger.error(exc.toString()); } catch (NoSuchMethodException exc) { logger.error(exc.toString()); } } }
private void recordRole(Class<?> clazz, String uri, boolean concept) throws ObjectStoreConfigException { if (uri == null || uri.length() == 0) { if (clazz.isAnnotation()) { roleMapper.addAnnotation(clazz); } else if (isAnnotationPresent(clazz) || concept) { roleMapper.addConcept(clazz); } else { roleMapper.addBehaviour(clazz); } } else { if (clazz.isAnnotation()) { roleMapper.addAnnotation(clazz, new URIImpl(uri)); } else if (isAnnotationPresent(clazz) || concept) { roleMapper.addConcept(clazz, new URIImpl(uri)); } else { roleMapper.addBehaviour(clazz, new URIImpl(uri)); } } }
mapper.addAnnotation(e.getKey()); } else { for (URI value : e.getValue()) { mapper.addAnnotation(e.getKey(), value);
private void recordRole(Class<?> clazz, String uri, boolean concept) throws ObjectStoreConfigException { if (uri == null || uri.length() == 0) { if (clazz.isAnnotation()) { roleMapper.addAnnotation(clazz); } else if (isAnnotationPresent(clazz) || concept) { roleMapper.addConcept(clazz); } else { roleMapper.addBehaviour(clazz); } } else { if (clazz.isAnnotation()) { roleMapper.addAnnotation(clazz, new URIImpl(uri)); } else if (isAnnotationPresent(clazz) || concept) { roleMapper.addConcept(clazz, new URIImpl(uri)); } else { roleMapper.addBehaviour(clazz, new URIImpl(uri)); } } }
mapper.addAnnotation(e.getKey()); } else { for (URI value : e.getValue()) { mapper.addAnnotation(e.getKey(), value);