org.intermine.model.bio.AnnotatableShadow Maven / Gradle / Ivy
package org.intermine.model.bio;
import org.intermine.objectstore.ObjectStore;
import org.intermine.objectstore.intermine.NotXmlParser;
import org.intermine.objectstore.intermine.NotXmlRenderer;
import org.intermine.objectstore.proxy.ProxyCollection;
import org.intermine.model.StringConstructor;
import org.intermine.metadata.TypeUtil;
import org.intermine.util.DynamicUtil;
import org.intermine.model.ShadowClass;
public class AnnotatableShadow implements Annotatable, ShadowClass
{
public static final Class shadowOf = Annotatable.class;
// Attr: org.intermine.model.bio.Annotatable.primaryIdentifier
protected java.lang.String primaryIdentifier;
public java.lang.String getPrimaryIdentifier() { return primaryIdentifier; }
public void setPrimaryIdentifier(final java.lang.String primaryIdentifier) { this.primaryIdentifier = primaryIdentifier; }
// Col: org.intermine.model.bio.Annotatable.ontologyAnnotations
protected java.util.Set ontologyAnnotations = new java.util.HashSet();
public java.util.Set getOntologyAnnotations() { return ontologyAnnotations; }
public void setOntologyAnnotations(final java.util.Set ontologyAnnotations) { this.ontologyAnnotations = ontologyAnnotations; }
public void addOntologyAnnotations(final org.intermine.model.bio.OntologyAnnotation arg) { ontologyAnnotations.add(arg); }
// Col: org.intermine.model.bio.Annotatable.publications
protected java.util.Set publications = new java.util.HashSet();
public java.util.Set getPublications() { return publications; }
public void setPublications(final java.util.Set publications) { this.publications = publications; }
public void addPublications(final org.intermine.model.bio.Publication arg) { publications.add(arg); }
// Attr: org.intermine.model.InterMineObject.id
protected java.lang.Integer id;
public java.lang.Integer getId() { return id; }
public void setId(final java.lang.Integer id) { this.id = id; }
@Override public boolean equals(Object o) { return (o instanceof Annotatable && id != null) ? id.equals(((Annotatable)o).getId()) : this == o; }
@Override public int hashCode() { return (id != null) ? id.hashCode() : super.hashCode(); }
@Override public String toString() { return "Annotatable [id=" + id + ", primaryIdentifier=" + (primaryIdentifier == null ? "null" : "\"" + primaryIdentifier + "\"") + "]"; }
public Object getFieldValue(final String fieldName) throws IllegalAccessException {
if ("primaryIdentifier".equals(fieldName)) {
return primaryIdentifier;
}
if ("ontologyAnnotations".equals(fieldName)) {
return ontologyAnnotations;
}
if ("publications".equals(fieldName)) {
return publications;
}
if ("id".equals(fieldName)) {
return id;
}
if (!org.intermine.model.bio.Annotatable.class.equals(getClass())) {
return TypeUtil.getFieldValue(this, fieldName);
}
throw new IllegalArgumentException("Unknown field " + fieldName);
}
public Object getFieldProxy(final String fieldName) throws IllegalAccessException {
if ("primaryIdentifier".equals(fieldName)) {
return primaryIdentifier;
}
if ("ontologyAnnotations".equals(fieldName)) {
return ontologyAnnotations;
}
if ("publications".equals(fieldName)) {
return publications;
}
if ("id".equals(fieldName)) {
return id;
}
if (!org.intermine.model.bio.Annotatable.class.equals(getClass())) {
return TypeUtil.getFieldProxy(this, fieldName);
}
throw new IllegalArgumentException("Unknown field " + fieldName);
}
public void setFieldValue(final String fieldName, final Object value) {
if ("primaryIdentifier".equals(fieldName)) {
primaryIdentifier = (java.lang.String) value;
} else if ("ontologyAnnotations".equals(fieldName)) {
ontologyAnnotations = (java.util.Set) value;
} else if ("publications".equals(fieldName)) {
publications = (java.util.Set) value;
} else if ("id".equals(fieldName)) {
id = (java.lang.Integer) value;
} else {
if (!org.intermine.model.bio.Annotatable.class.equals(getClass())) {
DynamicUtil.setFieldValue(this, fieldName, value);
return;
}
throw new IllegalArgumentException("Unknown field " + fieldName);
}
}
public Class> getFieldType(final String fieldName) {
if ("primaryIdentifier".equals(fieldName)) {
return java.lang.String.class;
}
if ("ontologyAnnotations".equals(fieldName)) {
return java.util.Set.class;
}
if ("publications".equals(fieldName)) {
return java.util.Set.class;
}
if ("id".equals(fieldName)) {
return java.lang.Integer.class;
}
if (!org.intermine.model.bio.Annotatable.class.equals(getClass())) {
return TypeUtil.getFieldType(org.intermine.model.bio.Annotatable.class, fieldName);
}
throw new IllegalArgumentException("Unknown field " + fieldName);
}
public StringConstructor getoBJECT() {
if (!org.intermine.model.bio.AnnotatableShadow.class.equals(getClass())) {
return NotXmlRenderer.render(this);
}
StringConstructor sb = new StringConstructor();
sb.append("$_^org.intermine.model.bio.Annotatable");
if (primaryIdentifier != null) {
sb.append("$_^aprimaryIdentifier$_^");
String string = primaryIdentifier;
while (string != null) {
int delimPosition = string.indexOf("$_^");
if (delimPosition == -1) {
sb.append(string);
string = null;
} else {
sb.append(string.substring(0, delimPosition + 3));
sb.append("d");
string = string.substring(delimPosition + 3);
}
}
}
if (id != null) {
sb.append("$_^aid$_^").append(id);
}
return sb;
}
public void setoBJECT(String notXml, ObjectStore os) {
setoBJECT(NotXmlParser.SPLITTER.split(notXml), os);
}
public void setoBJECT(final String[] notXml, final ObjectStore os) {
if (!org.intermine.model.bio.AnnotatableShadow.class.equals(getClass())) {
throw new IllegalStateException("Class " + getClass().getName() + " does not match code (org.intermine.model.bio.Annotatable)");
}
for (int i = 2; i < notXml.length;) {
int startI = i;
if ((i < notXml.length) && "aprimaryIdentifier".equals(notXml[i])) {
i++;
StringBuilder string = null;
while ((i + 1 < notXml.length) && (notXml[i + 1].charAt(0) == 'd')) {
if (string == null) string = new StringBuilder(notXml[i]);
i++;
string.append("$_^").append(notXml[i].substring(1));
}
primaryIdentifier = string == null ? notXml[i] : string.toString();
i++;
}
if ((i < notXml.length) && "aid".equals(notXml[i])) {
i++;
id = Integer.valueOf(notXml[i]);
i++;
}
if (startI == i) {
throw new IllegalArgumentException("Unknown field " + notXml[i]);
}
}
ontologyAnnotations = new ProxyCollection(os, this, "ontologyAnnotations", org.intermine.model.bio.OntologyAnnotation.class);
publications = new ProxyCollection(os, this, "publications", org.intermine.model.bio.Publication.class);
}
public void addCollectionElement(final String fieldName, final org.intermine.model.InterMineObject element) {
if ("ontologyAnnotations".equals(fieldName)) {
ontologyAnnotations.add((org.intermine.model.bio.OntologyAnnotation) element);
} else if ("publications".equals(fieldName)) {
publications.add((org.intermine.model.bio.Publication) element);
} else {
if (!org.intermine.model.bio.Annotatable.class.equals(getClass())) {
TypeUtil.addCollectionElement(this, fieldName, element);
return;
}
throw new IllegalArgumentException("Unknown collection " + fieldName);
}
}
public Class> getElementType(final String fieldName) {
if ("ontologyAnnotations".equals(fieldName)) {
return org.intermine.model.bio.OntologyAnnotation.class;
}
if ("publications".equals(fieldName)) {
return org.intermine.model.bio.Publication.class;
}
if (!org.intermine.model.bio.Annotatable.class.equals(getClass())) {
return TypeUtil.getElementType(org.intermine.model.bio.Annotatable.class, fieldName);
}
throw new IllegalArgumentException("Unknown field " + fieldName);
}
}