1 19 20 21 package org.apache.cayenne.jpa.map; 22 23 import java.util.ArrayList ; 24 import java.util.Collection ; 25 26 import javax.persistence.EntityResult; 27 28 import org.apache.cayenne.util.TreeNodeChild; 29 30 public class JpaEntityResult { 31 32 protected String entityClassName; 33 protected String discriminatorColumn; 34 protected Collection <JpaFieldResult> fieldResults; 35 36 public JpaEntityResult() { 37 38 } 39 40 public JpaEntityResult(EntityResult annotation) { 41 entityClassName = annotation.entityClass().getName(); 42 discriminatorColumn = annotation.discriminatorColumn(); 43 44 getFieldResults(); 45 for (int i = 0; i < annotation.fields().length; i++) { 46 fieldResults.add(new JpaFieldResult(annotation.fields()[i])); 47 } 48 } 49 50 @TreeNodeChild(type=JpaFieldResult.class) 51 public Collection <JpaFieldResult> getFieldResults() { 52 if (fieldResults == null) { 53 fieldResults = new ArrayList <JpaFieldResult>(); 54 } 55 56 return fieldResults; 57 } 58 59 public String getDiscriminatorColumn() { 60 return discriminatorColumn; 61 } 62 63 public void setDiscriminatorColumn(String descriminatorColumn) { 64 this.discriminatorColumn = descriminatorColumn; 65 } 66 67 public String getEntityClassName() { 68 return entityClassName; 69 } 70 71 public void setEntityClassName(String entityClassName) { 72 this.entityClassName = entityClassName; 73 } 74 } 75 | Popular Tags |