PageRenderTime 52ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/zfinmine/dbmodel/build/gen/src/org/intermine/model/bio/AnnotationShadow.java

https://github.com/sierramoxon/ZFINmine
Java | 254 lines | 241 code | 7 blank | 6 comment | 86 complexity | 526f954819ec83ce76ce3fd6ed61c9e3 MD5 | raw file
  1. package org.intermine.model.bio;
  2. import org.intermine.objectstore.ObjectStore;
  3. import org.intermine.objectstore.intermine.NotXmlParser;
  4. import org.intermine.objectstore.intermine.NotXmlRenderer;
  5. import org.intermine.objectstore.proxy.ProxyCollection;
  6. import org.intermine.objectstore.proxy.ProxyReference;
  7. import org.intermine.util.StringConstructor;
  8. import org.intermine.util.StringUtil;
  9. import org.intermine.util.TypeUtil;
  10. import org.intermine.model.ShadowClass;
  11. public class AnnotationShadow implements Annotation, org.intermine.model.ShadowClass
  12. {
  13. public static final Class shadowOf = Annotation.class;
  14. // Attr: org.intermine.model.bio.Annotation.qualifier
  15. protected java.lang.String qualifier;
  16. public java.lang.String getQualifier() { return qualifier; }
  17. public void setQualifier(final java.lang.String qualifier) { this.qualifier = qualifier; }
  18. // Ref: org.intermine.model.bio.Annotation.property
  19. protected org.intermine.model.InterMineObject property;
  20. public org.intermine.model.bio.BioProperty getProperty() { if (property instanceof org.intermine.objectstore.proxy.ProxyReference) { return ((org.intermine.model.bio.BioProperty) ((org.intermine.objectstore.proxy.ProxyReference) property).getObject()); }; return (org.intermine.model.bio.BioProperty) property; }
  21. public void setProperty(final org.intermine.model.bio.BioProperty property) { this.property = property; }
  22. public void proxyProperty(final org.intermine.objectstore.proxy.ProxyReference property) { this.property = property; }
  23. public org.intermine.model.InterMineObject proxGetProperty() { return property; }
  24. // Ref: org.intermine.model.bio.Annotation.subject
  25. protected org.intermine.model.InterMineObject subject;
  26. public org.intermine.model.bio.BioEntity getSubject() { if (subject instanceof org.intermine.objectstore.proxy.ProxyReference) { return ((org.intermine.model.bio.BioEntity) ((org.intermine.objectstore.proxy.ProxyReference) subject).getObject()); }; return (org.intermine.model.bio.BioEntity) subject; }
  27. public void setSubject(final org.intermine.model.bio.BioEntity subject) { this.subject = subject; }
  28. public void proxySubject(final org.intermine.objectstore.proxy.ProxyReference subject) { this.subject = subject; }
  29. public org.intermine.model.InterMineObject proxGetSubject() { return subject; }
  30. // Col: org.intermine.model.bio.Annotation.dataSets
  31. protected java.util.Set<org.intermine.model.bio.DataSet> dataSets = new java.util.HashSet();
  32. public java.util.Set<org.intermine.model.bio.DataSet> getDataSets() { return dataSets; }
  33. public void setDataSets(final java.util.Set<org.intermine.model.bio.DataSet> dataSets) { this.dataSets = dataSets; }
  34. public void addDataSets(final org.intermine.model.bio.DataSet arg) { dataSets.add(arg); }
  35. // Col: org.intermine.model.bio.Annotation.publications
  36. protected java.util.Set<org.intermine.model.bio.Publication> publications = new java.util.HashSet();
  37. public java.util.Set<org.intermine.model.bio.Publication> getPublications() { return publications; }
  38. public void setPublications(final java.util.Set<org.intermine.model.bio.Publication> publications) { this.publications = publications; }
  39. public void addPublications(final org.intermine.model.bio.Publication arg) { publications.add(arg); }
  40. // Attr: org.intermine.model.InterMineObject.id
  41. protected java.lang.Integer id;
  42. public java.lang.Integer getId() { return id; }
  43. public void setId(final java.lang.Integer id) { this.id = id; }
  44. public boolean equals(Object o) { return (o instanceof Annotation && id != null) ? id.equals(((Annotation)o).getId()) : this == o; }
  45. public int hashCode() { return (id != null) ? id.hashCode() : super.hashCode(); }
  46. public String toString() { return "Annotation [id=\"" + id + "\", property=" + (property == null ? "null" : (property.getId() == null ? "no id" : property.getId().toString())) + ", qualifier=\"" + qualifier + "\", subject=" + (subject == null ? "null" : (subject.getId() == null ? "no id" : subject.getId().toString())) + "]"; }
  47. public Object getFieldValue(final String fieldName) throws IllegalAccessException {
  48. if ("qualifier".equals(fieldName)) {
  49. return qualifier;
  50. }
  51. if ("property".equals(fieldName)) {
  52. if (property instanceof ProxyReference) {
  53. return ((ProxyReference) property).getObject();
  54. } else {
  55. return property;
  56. }
  57. }
  58. if ("subject".equals(fieldName)) {
  59. if (subject instanceof ProxyReference) {
  60. return ((ProxyReference) subject).getObject();
  61. } else {
  62. return subject;
  63. }
  64. }
  65. if ("dataSets".equals(fieldName)) {
  66. return dataSets;
  67. }
  68. if ("publications".equals(fieldName)) {
  69. return publications;
  70. }
  71. if ("id".equals(fieldName)) {
  72. return id;
  73. }
  74. if (!org.intermine.model.bio.Annotation.class.equals(getClass())) {
  75. return TypeUtil.getFieldValue(this, fieldName);
  76. }
  77. throw new IllegalArgumentException("Unknown field " + fieldName);
  78. }
  79. public Object getFieldProxy(final String fieldName) throws IllegalAccessException {
  80. if ("qualifier".equals(fieldName)) {
  81. return qualifier;
  82. }
  83. if ("property".equals(fieldName)) {
  84. return property;
  85. }
  86. if ("subject".equals(fieldName)) {
  87. return subject;
  88. }
  89. if ("dataSets".equals(fieldName)) {
  90. return dataSets;
  91. }
  92. if ("publications".equals(fieldName)) {
  93. return publications;
  94. }
  95. if ("id".equals(fieldName)) {
  96. return id;
  97. }
  98. if (!org.intermine.model.bio.Annotation.class.equals(getClass())) {
  99. return TypeUtil.getFieldProxy(this, fieldName);
  100. }
  101. throw new IllegalArgumentException("Unknown field " + fieldName);
  102. }
  103. public void setFieldValue(final String fieldName, final Object value) {
  104. if ("qualifier".equals(fieldName)) {
  105. qualifier = (java.lang.String) value;
  106. } else if ("property".equals(fieldName)) {
  107. property = (org.intermine.model.InterMineObject) value;
  108. } else if ("subject".equals(fieldName)) {
  109. subject = (org.intermine.model.InterMineObject) value;
  110. } else if ("dataSets".equals(fieldName)) {
  111. dataSets = (java.util.Set) value;
  112. } else if ("publications".equals(fieldName)) {
  113. publications = (java.util.Set) value;
  114. } else if ("id".equals(fieldName)) {
  115. id = (java.lang.Integer) value;
  116. } else {
  117. if (!org.intermine.model.bio.Annotation.class.equals(getClass())) {
  118. TypeUtil.setFieldValue(this, fieldName, value);
  119. return;
  120. }
  121. throw new IllegalArgumentException("Unknown field " + fieldName);
  122. }
  123. }
  124. public Class getFieldType(final String fieldName) {
  125. if ("qualifier".equals(fieldName)) {
  126. return java.lang.String.class;
  127. }
  128. if ("property".equals(fieldName)) {
  129. return org.intermine.model.bio.BioProperty.class;
  130. }
  131. if ("subject".equals(fieldName)) {
  132. return org.intermine.model.bio.BioEntity.class;
  133. }
  134. if ("dataSets".equals(fieldName)) {
  135. return java.util.Set.class;
  136. }
  137. if ("publications".equals(fieldName)) {
  138. return java.util.Set.class;
  139. }
  140. if ("id".equals(fieldName)) {
  141. return java.lang.Integer.class;
  142. }
  143. if (!org.intermine.model.bio.Annotation.class.equals(getClass())) {
  144. return TypeUtil.getFieldType(org.intermine.model.bio.Annotation.class, fieldName);
  145. }
  146. throw new IllegalArgumentException("Unknown field " + fieldName);
  147. }
  148. public StringConstructor getoBJECT() {
  149. if (!org.intermine.model.bio.Annotation.class.equals(getClass())) {
  150. return NotXmlRenderer.render(this);
  151. }
  152. StringConstructor sb = new StringConstructor();
  153. sb.append("$_^org.intermine.model.bio.Annotation");
  154. if (qualifier != null) {
  155. sb.append("$_^aqualifier$_^");
  156. String string = qualifier;
  157. while (string != null) {
  158. int delimPosition = string.indexOf("$_^");
  159. if (delimPosition == -1) {
  160. sb.append(string);
  161. string = null;
  162. } else {
  163. sb.append(string.substring(0, delimPosition + 3));
  164. sb.append("d");
  165. string = string.substring(delimPosition + 3);
  166. }
  167. }
  168. }
  169. if (property != null) {
  170. sb.append("$_^rproperty$_^").append(property.getId());
  171. }
  172. if (subject != null) {
  173. sb.append("$_^rsubject$_^").append(subject.getId());
  174. }
  175. if (id != null) {
  176. sb.append("$_^aid$_^").append(id);
  177. }
  178. return sb;
  179. }
  180. public void setoBJECT(String notXml, ObjectStore os) {
  181. setoBJECT(NotXmlParser.SPLITTER.split(notXml), os);
  182. }
  183. public void setoBJECT(final String[] notXml, final ObjectStore os) {
  184. if (!org.intermine.model.bio.Annotation.class.equals(getClass())) {
  185. throw new IllegalStateException("Class " + getClass().getName() + " does not match code (org.intermine.model.bio.Annotation)");
  186. }
  187. for (int i = 2; i < notXml.length;) {
  188. int startI = i;
  189. if ((i < notXml.length) && "aqualifier".equals(notXml[i])) {
  190. i++;
  191. StringBuilder string = null;
  192. while ((i + 1 < notXml.length) && (notXml[i + 1].charAt(0) == 'd')) {
  193. if (string == null) string = new StringBuilder(notXml[i]);
  194. i++;
  195. string.append("$_^").append(notXml[i].substring(1));
  196. }
  197. qualifier = string == null ? notXml[i] : string.toString();
  198. i++;
  199. }
  200. if ((i < notXml.length) &&"rproperty".equals(notXml[i])) {
  201. i++;
  202. property = new ProxyReference(os, Integer.valueOf(notXml[i]), org.intermine.model.bio.BioProperty.class);
  203. i++;
  204. };
  205. if ((i < notXml.length) &&"rsubject".equals(notXml[i])) {
  206. i++;
  207. subject = new ProxyReference(os, Integer.valueOf(notXml[i]), org.intermine.model.bio.BioEntity.class);
  208. i++;
  209. };
  210. if ((i < notXml.length) && "aid".equals(notXml[i])) {
  211. i++;
  212. id = Integer.valueOf(notXml[i]);
  213. i++;
  214. }
  215. if (startI == i) {
  216. throw new IllegalArgumentException("Unknown field " + notXml[i]);
  217. }
  218. }
  219. dataSets = new ProxyCollection(os, this, "dataSets", org.intermine.model.bio.DataSet.class);
  220. publications = new ProxyCollection(os, this, "publications", org.intermine.model.bio.Publication.class);
  221. }
  222. public void addCollectionElement(final String fieldName, final org.intermine.model.InterMineObject element) {
  223. if ("dataSets".equals(fieldName)) {
  224. dataSets.add((org.intermine.model.bio.DataSet) element);
  225. } else if ("publications".equals(fieldName)) {
  226. publications.add((org.intermine.model.bio.Publication) element);
  227. } else {
  228. if (!org.intermine.model.bio.Annotation.class.equals(getClass())) {
  229. TypeUtil.addCollectionElement(this, fieldName, element);
  230. return;
  231. }
  232. throw new IllegalArgumentException("Unknown collection " + fieldName);
  233. }
  234. }
  235. public Class getElementType(final String fieldName) {
  236. if ("dataSets".equals(fieldName)) {
  237. return org.intermine.model.bio.DataSet.class;
  238. }
  239. if ("publications".equals(fieldName)) {
  240. return org.intermine.model.bio.Publication.class;
  241. }
  242. if (!org.intermine.model.bio.Annotation.class.equals(getClass())) {
  243. return TypeUtil.getElementType(org.intermine.model.bio.Annotation.class, fieldName);
  244. }
  245. throw new IllegalArgumentException("Unknown field " + fieldName);
  246. }
  247. }