01: package com.bm.introspectors.relations;
02:
03: import java.util.Set;
04:
05: import javax.persistence.ManyToOne;
06:
07: import com.bm.introspectors.Property;
08:
09: /**
10: * Represents a ManyToOne relation.
11: *
12: * @author Daniel Wiese
13: *
14: */
15: public class ManyToOneReleation extends AbstractRelation implements
16: EntityReleationInfo {
17:
18: Set<Property> targetKeyProperty;
19:
20: /**
21: * Default constructor.
22: *
23: * @param sourceClass -
24: * the type of the source entity bean
25: * @param targetClass -
26: * the type of the target entity bean
27: * @param sourceProperty -
28: * the property of the source entity bean
29: * @param targetProperty -
30: * the property of the target entity bean
31: *
32: *
33: * @param annotation -
34: * the annotation (with values)
35: */
36: public ManyToOneReleation(Class sourceClass, Class targetClass,
37: Property sourceProperty, Property targetProperty,
38: ManyToOne annotation) {
39: super (sourceClass, targetClass, sourceProperty, targetProperty,
40: annotation.fetch(), annotation.cascade());
41: }
42:
43: /**
44: * Returns the type of the relation.
45: * @return the type of the relation.
46: * @see com.bm.introspectors.relations.EntityReleationInfo#getReleationType()
47: */
48: public RelationType getReleationType() {
49: return RelationType.ManyToOne;
50: }
51:
52: /**
53: * Returns the primary key properties of the target class
54: * @return the primary key properties of the target class
55: */
56: public Set<Property> getTargetKeyProperty() {
57: return targetKeyProperty;
58: }
59:
60: /**
61: * Sets the primary key properties of the target class
62: * @param targetKeyProp
63: */
64: public void setTargetKeyProperty(Set<Property> targetKeyProp) {
65: this.targetKeyProperty = targetKeyProp;
66: }
67: }
|