Tabnine Logo
CollectionDescriptor.getReferencedClassDescriptor
Code IndexAdd Tabnine to your IDE (free)

How to use
getReferencedClassDescriptor
method
in
org.intermine.metadata.CollectionDescriptor

Best Java code snippets using org.intermine.metadata.CollectionDescriptor.getReferencedClassDescriptor (Showing top 14 results out of 315)

origin: intermine/intermine

/**
 * Takes a Class, and generates a Map of all the collections that are in the Class or any of its
 * parents. The Class may be a dynamic class - ie not in the model, although at least one of its
 * parents are in the model.
 *
 * @param c a Class
 * @return a Map from String collection name to Class element type
 */
public Map<String, Class<?>> getCollectionsForClass(Class<?> c) {
  synchronized (classToCollectionsMap) {
    Map<String, Class<?>> retval = classToCollectionsMap.get(c);
    if (retval == null) {
      retval = new LinkedHashMap<String, Class<?>>();
      for (FieldDescriptor fd : getFieldDescriptorsForClass(c).values()) {
        if (fd instanceof CollectionDescriptor) {
          CollectionDescriptor cd = (CollectionDescriptor) fd;
          retval.put(cd.getName(), cd.getReferencedClassDescriptor().getType());
        }
      }
      classToCollectionsMap.put(c, retval);
    }
    return retval;
  }
}
origin: org.intermine/intermine-model

/**
 * Takes a Class, and generates a Map of all the collections that are in the Class or any of its
 * parents. The Class may be a dynamic class - ie not in the model, although at least one of its
 * parents are in the model.
 *
 * @param c a Class
 * @return a Map from String collection name to Class element type
 */
public Map<String, Class<?>> getCollectionsForClass(Class<?> c) {
  synchronized (classToCollectionsMap) {
    Map<String, Class<?>> retval = classToCollectionsMap.get(c);
    if (retval == null) {
      retval = new LinkedHashMap<String, Class<?>>();
      for (FieldDescriptor fd : getFieldDescriptorsForClass(c).values()) {
        if (fd instanceof CollectionDescriptor) {
          CollectionDescriptor cd = (CollectionDescriptor) fd;
          retval.put(cd.getName(), cd.getReferencedClassDescriptor().getType());
        }
      }
      classToCollectionsMap.put(c, retval);
    }
    return retval;
  }
}
origin: org.intermine/intermine-model

  .append(StringUtil.reverseCapitalisation(name))
  .append("(final ")
  .append(((CollectionDescriptor) field).getReferencedClassDescriptor().getName())
  .append(" arg)");
if (fieldPresent) {
origin: intermine/intermine

  .append(StringUtil.reverseCapitalisation(name))
  .append("(final ")
  .append(((CollectionDescriptor) field).getReferencedClassDescriptor().getName())
  .append(" arg)");
if (fieldPresent) {
origin: org.intermine/intermine-objectstore

CollectionDescriptor cd = (CollectionDescriptor) fd;
@SuppressWarnings("unchecked") Collection lazyColl = new ProxyCollection(os,
    (InterMineObject) retval, cd.getName(), cd.getReferencedClassDescriptor()
      .getType());
retval.setFieldValue(cd.getName(), lazyColl);
origin: intermine/intermine

CollectionDescriptor cd = (CollectionDescriptor) fd;
@SuppressWarnings("unchecked") Collection lazyColl = new ProxyCollection(os,
    (InterMineObject) retval, cd.getName(), cd.getReferencedClassDescriptor()
      .getType());
retval.setFieldValue(cd.getName(), lazyColl);
origin: org.intermine/intermine-objectstore

CollectionDescriptor coll = (CollectionDescriptor) maybeColl;
Collection<Object> lazyColl = new ProxyCollection<Object>(os, retval,
    coll.getName(), coll.getReferencedClassDescriptor().getType());
retval.setFieldValue(coll.getName(), lazyColl);
origin: intermine/intermine

CollectionDescriptor coll = (CollectionDescriptor) maybeColl;
Collection<Object> lazyColl = new ProxyCollection<Object>(os, retval,
    coll.getName(), coll.getReferencedClassDescriptor().getType());
retval.setFieldValue(coll.getName(), lazyColl);
origin: intermine/intermine

public void testReferencedClassNotSet() throws Exception {
  CollectionDescriptor cod1 = new CollectionDescriptor("cod1", "Class2", null);
  Set<CollectionDescriptor> collections = Collections.singleton(cod1);
  // cld1 has a CollectionDescriptor that contains objects of type Class2
  new ClassDescriptor("Class1", null, false, noAttrs, noRefs, collections);
  new ClassDescriptor("Class2", null, false, noAttrs, noRefs, noColls);
  try {
    cod1.getReferencedClassDescriptor();
    fail("Expected IllegalStateException, model has not yet been set");
  } catch (IllegalStateException e) {
  }
}
origin: intermine/intermine

public void testGetReferencedClass() throws Exception {
  CollectionDescriptor cod1 = new CollectionDescriptor("cod1", "package.name.Class2", null);
  Set<CollectionDescriptor> collections = Collections.singleton(cod1);
  // cld1 has a ReferenceDescriptor that points to Class2
  ClassDescriptor cld1 = new ClassDescriptor("package.name.Class1", null, false, noAttrs, noRefs, collections);
  ClassDescriptor cld2 = new ClassDescriptor("package.name.Class2", null, false, noAttrs, noRefs, noColls);
  new Model("model", "package.name", Arrays.asList(cld1, cld2));
  try {
    ClassDescriptor refCld = cod1.getReferencedClassDescriptor();
    assertTrue("ClassDescriptor was null", refCld != null);
    assertTrue("Expected ClassDescriptor to be Class2", refCld.getName().equals("package.name.Class2"));
  } catch (IllegalStateException e) {
    fail("Should have returned a ClassDescriptor");
  }
}
origin: intermine/intermine

if (coll.relationType() == FieldDescriptor.ONE_N_RELATION) {
  QueryClass qc = new QueryClass(coll
      .getReferencedClassDescriptor().getType());
  subQ.addFrom(qc);
  QueryForeignKey qfk = new QueryForeignKey(qc,
  QueryClass qc1 = new QueryClass(clazz);
  QueryClass qc2 = new QueryClass(coll
      .getReferencedClassDescriptor().getType());
  subQ.addFrom(qc1);
  subQ.addFrom(qc2);
  QueryClass qc1 = new QueryClass(clazz);
  QueryClass qc2 = new QueryClass(coll
      .getReferencedClassDescriptor().getType());
  subQ.addFrom(qc1);
  subQ.addFrom(qc2);
origin: org.intermine/intermine-objectstore

if (coll.relationType() == FieldDescriptor.ONE_N_RELATION) {
  QueryClass qc = new QueryClass(coll
      .getReferencedClassDescriptor().getType());
  subQ.addFrom(qc);
  QueryForeignKey qfk = new QueryForeignKey(qc,
  QueryClass qc1 = new QueryClass(clazz);
  QueryClass qc2 = new QueryClass(coll
      .getReferencedClassDescriptor().getType());
  subQ.addFrom(qc1);
  subQ.addFrom(qc2);
  QueryClass qc1 = new QueryClass(clazz);
  QueryClass qc2 = new QueryClass(coll
      .getReferencedClassDescriptor().getType());
  subQ.addFrom(qc1);
  subQ.addFrom(qc2);
origin: org.intermine/intermine-pathquery

/**
 * If the last element in the path is a reference or collection return the ClassDescriptor that
 * the reference or collection references.  If the path has one element (eg. "Employee"),
 * return its ClassDescriptor.  If the last element in the path is an attribute, return null.
 * @return the ClassDescriptor
 */
public ClassDescriptor getEndClassDescriptor() {
  if (getEndFieldDescriptor() == null) {
    return getStartClassDescriptor();
  }
  if (!getEndFieldDescriptor().isAttribute()) {
    if (getEndFieldDescriptor().isCollection()) {
      CollectionDescriptor collDesc = (CollectionDescriptor) getEndFieldDescriptor();
      return collDesc.getReferencedClassDescriptor();
    }
    if  (getEndFieldDescriptor().isReference()) {
      ReferenceDescriptor refDesc =  (ReferenceDescriptor) getEndFieldDescriptor();
      return refDesc.getReferencedClassDescriptor();
    }
  }
  return null;
}
origin: intermine/intermine

/**
 * If the last element in the path is a reference or collection return the ClassDescriptor that
 * the reference or collection references.  If the path has one element (eg. "Employee"),
 * return its ClassDescriptor.  If the last element in the path is an attribute, return null.
 * @return the ClassDescriptor
 */
public ClassDescriptor getEndClassDescriptor() {
  if (getEndFieldDescriptor() == null) {
    return getStartClassDescriptor();
  }
  if (!getEndFieldDescriptor().isAttribute()) {
    if (getEndFieldDescriptor().isCollection()) {
      CollectionDescriptor collDesc = (CollectionDescriptor) getEndFieldDescriptor();
      return collDesc.getReferencedClassDescriptor();
    }
    if  (getEndFieldDescriptor().isReference()) {
      ReferenceDescriptor refDesc =  (ReferenceDescriptor) getEndFieldDescriptor();
      return refDesc.getReferencedClassDescriptor();
    }
  }
  return null;
}
org.intermine.metadataCollectionDescriptorgetReferencedClassDescriptor

Popular methods of CollectionDescriptor

  • <init>
    Construct a CollectionDescriptor. name and referencedType may not be null.
  • getReverseReferenceDescriptor
  • getClassDescriptor
  • getName
  • getReferencedClassName
  • getReverseReferenceFieldName
  • relationType
  • findReferencedDescriptor
  • equals
  • hashCode
  • setClassDescriptor
  • toString
  • setClassDescriptor,
  • toString

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getApplicationContext (Context)
  • getSystemService (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now