Package: GenClassClass
GenClassClass
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
GenClassClass(String, Collection, Collection, Collection, Collection, Collection, GenClassClass, GenPackage, GenComment, String) |
|
|
|
|
|
||||||||||||||||||||
accept(GenClassVisitor) |
|
|
|
|
|
||||||||||||||||||||
accept(GenClassVisitorException) |
|
|
|
|
|
||||||||||||||||||||
accept(GenClassVisitorReturn) |
|
|
|
|
|
||||||||||||||||||||
addConstructor(GenJavaOperation) |
|
|
|
|
|
||||||||||||||||||||
getAttributes() |
|
|
|
|
|
||||||||||||||||||||
getConstructors() |
|
|
|
|
|
||||||||||||||||||||
getExtend() |
|
|
|
|
|
||||||||||||||||||||
getModifieres() |
|
|
|
|
|
||||||||||||||||||||
setExtend(GenClassClass) |
|
|
|
|
|
Coverage
1: package de.fhdw.wtf.generator.java.generatorModel;
2:
3: import java.util.Collection;
4:
5: import de.fhdw.wtf.generator.java.visitor.GenClassClassVisitor;
6: import de.fhdw.wtf.generator.java.visitor.GenClassClassVisitorException;
7: import de.fhdw.wtf.generator.java.visitor.GenClassClassVisitorReturn;
8: import de.fhdw.wtf.generator.java.visitor.GenClassVisitorException;
9: import de.fhdw.wtf.generator.java.visitor.GenClassVisitorReturn;
10:
11: public abstract class GenClassClass extends GenClass {
12:
13: private final Collection<GenJavaAttribute> attributes;
14: private final Collection<GenClassModifier> modifieres;
15: private final Collection<GenJavaOperation> constructors;
16:
17: /**
18: * The GenClassClass this GenClassClass shall extend.
19: */
20: private GenClassClass extend;
21:
22: /**
23: * Constructor for GenClassClass.
24: *
25: * @param name
26: * The name of the class and the java-file to generate.
27: * @param attributes
28: * The attribute the class has.
29: * @param operations
30: * The operations the class has.
31: * @param modifiers
32: * The class-modifiers for this class. For example "public".
33: * @param constructors
34: * The constructor-operations for this class.
35: * @param implement
36: * The interfaces the class implements.
37: * @param extend
38: * The class the class extends.
39: * @param comment
40: * The comment that describes this class.
41: * @param packag
42: * The package the class will be generated in.
43: * @param nonGeneratedPart
44: * Additional lines of code.
45: */
46: protected GenClassClass(final String name,
47: final Collection<GenJavaOperation> operations,
48: final Collection<GenInterfaceClass> implement,
49: final Collection<GenJavaAttribute> attributes,
50: final Collection<GenClassModifier> modifiers,
51: final Collection<GenJavaOperation> constructors,
52: final GenClassClass extend,
53: final GenPackage packag,
54: final GenComment comment,
55: final String nonGeneratedPart) {
56: super(name, operations, implement, packag, comment, nonGeneratedPart);
57: this.attributes = attributes;
58: this.modifieres = modifiers;
59: this.constructors = constructors;
60: this.extend = extend;
61: }
62:
63: @Override
64: public void accept(final de.fhdw.wtf.generator.java.visitor.GenClassVisitor visitor) {
65: visitor.handle(this);
66: }
67:
68: @Override
69: public <X> X accept(final GenClassVisitorReturn<X> visitor) {
70: return visitor.handle(this);
71: }
72:
73: /**
74: * Calls the handle method in the given visitor.
75: *
76: * @param visitor
77: * The visitor to handle this type.
78: */
79: public abstract void accept(GenClassClassVisitor visitor);
80:
81: /**
82: * Calls the handle method in the given visitor.
83: *
84: * @param visitor
85: * The visitor to handle this type.
86: * @param <X>
87: * The returnType of the handle and the accept method.
88: * @return Returns the result of type <X> that is returned by the handle method.
89: */
90: public abstract <X> X accept(GenClassClassVisitorReturn<X> visitor);
91:
92: /**
93: * Calls the handle method in the given visitor.
94: *
95: * @param visitor
96: * The visitor to handle this type.
97: * @param <Y>
98: * The exception that could be thrown by calling this method.
99: * @throws Y
100: * The given exception
101: */
102: public abstract <Y extends java.lang.Exception> void accept(GenClassClassVisitorException<Y> visitor) throws Y;
103:
104: @Override
105: public <X extends java.lang.Exception> void accept(final GenClassVisitorException<X> visitor) throws X {
106: visitor.handle(this);
107: }
108:
109: /**
110: * Returns the attributes of this GenClassClass.
111: *
112: * @return Collection<GenJavaAttribute>
113: */
114: public Collection<GenJavaAttribute> getAttributes() {
115: return this.attributes;
116: }
117:
118: /**
119: * Returns the GenClassModifiers of this GenClassClass.
120: *
121: * @return Collection<GenClassModifiers>
122: */
123: public Collection<GenClassModifier> getModifieres() {
124: return this.modifieres;
125: }
126:
127: /**
128: * Returns all constructor methods of this GenClassClass.
129: *
130: * @return Collection<GenJavaOperation>
131: */
132: public Collection<GenJavaOperation> getConstructors() {
133: return this.constructors;
134: }
135:
136: /**
137: * Adds the given GenJavaOperation as constructor to this class.
138: *
139: * @param constructor
140: * the constructor.
141: */
142: public void addConstructor(final GenJavaOperation constructor) {
143: this.constructors.add(constructor);
144: }
145:
146: /**
147: * Returns the GenClassClass this GenClassClass extends.
148: *
149: * @return GenClassClass
150: */
151: public GenClassClass getExtend() {
152: return this.extend;
153: }
154:
155: /**
156: * Sets the extends declaration from this GenClassClass to the provided GenClassClass. Beware! It is not possible to
157: * extends more than one GenClassClass.
158: *
159: * @param extend
160: * The GenClass to extend.
161: */
162: public void setExtend(final GenClassClass extend) {
163: this.extend = extend;
164: }
165:
166: }