Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/Java/PoVoGenerator/Generator/src/org/litesoft/generator/GenerateVOGO.java

Diff revisions: vs.
  @@ -6,36 +6,30 @@
6 6 import org.litesoft.codegen.*;
7 7 import org.litesoft.commonfoundation.typeutils.*;
8 8
9 - public class GenerateVOGO extends AbstractVOFileGenerator
10 - {
9 + public class GenerateVOGO extends AbstractVOFileGenerator {
11 10 private String mVoAttributeGenericType = "XXX";
12 11
13 - public GenerateVOGO( ErrorSinc pErrorSinc, ObjectMetaData pObjectMetaData, DerivedObjectTuple pDerivedFromObject, ObjectRef pObjectRef, ObjectRef pParentObjectRef )
14 - {
12 + public GenerateVOGO( ErrorSinc pErrorSinc, ObjectMetaData pObjectMetaData, DerivedObjectTuple pDerivedFromObject, ObjectRef pObjectRef,
13 + ObjectRef pParentObjectRef ) {
15 14 super( pErrorSinc, pObjectMetaData, pDerivedFromObject, pObjectRef, "GO", pParentObjectRef );
16 15 }
17 16
18 17 @Override
19 - protected void LLaddImports()
20 - {
18 + protected void LLaddImports() {
21 19 addImports( //
22 20 "org.litesoft.bo.views.*", //
23 21 null );
24 22 }
25 23
26 24 @Override
27 - protected void LLaddClassDefinition()
28 - {
25 + protected void LLaddClassDefinition() {
29 26 String zClassName = mClassName;
30 27 String zExtendsName = getExtends( "ViewObject" );
31 28
32 - if ( mIsParent )
33 - {
29 + if ( mIsParent ) {
34 30 zClassName += "<T extends " + mObjectName + "<T>>";
35 31 mVoAttributeGenericType = "T";
36 - }
37 - else
38 - {
32 + } else {
39 33 mVoAttributeGenericType = mObjectName;
40 34 }
41 35
  @@ -45,28 +39,22 @@
45 39 }
46 40
47 41 @Override
48 - protected void LLaddClassBody()
49 - {
42 + protected void LLaddClassBody() {
50 43 constructors();
51 - for ( AttributeProxy zAttribute : getAttributes() )
52 - {
44 + for ( AttributeProxy zAttribute : getAttributes() ) {
53 45 attribute( zAttribute );
54 46 }
55 47 }
56 48
57 - private void constructors()
58 - {
59 - if ( mIsParent )
60 - {
49 + private void constructors() {
50 + if ( mIsParent ) {
61 51 addConstructorProtected( mClassName, mObjectName + "MetaData<T> pMetaData" );
62 52 addLine( "super( pMetaData );" );
63 53 addMethodEnd();
64 54 addConstructorProtected( mClassName, mObjectName + "MetaData<T> pMetaData", "boolean pNew", "TransactionSet pTransactionSet" );
65 55 addLine( "super( pMetaData, pNew, pTransactionSet );" );
66 56 addBlockEnd();
67 - }
68 - else
69 - {
57 + } else {
70 58 addLine( "@Deprecated" );
71 59 addConstructorProtected( mClassName );
72 60 addLine( "super( " + mObjectName + "MetaData.getInstance() );" );
  @@ -77,11 +65,9 @@
77 65 }
78 66 }
79 67
80 - private void attribute( AttributeProxy pAttribute )
81 - {
68 + private void attribute( AttributeProxy pAttribute ) {
82 69 Class zSimpleDataTypeClass = pAttribute.getSimpleDataType();
83 - if ( zSimpleDataTypeClass == null )
84 - {
70 + if ( zSimpleDataTypeClass == null ) {
85 71 mErrorSinc.addError( "CurrentlyUnsupportedAttributeType", pAttribute.toString(), mObjectMetaData.toStringForError() );
86 72 return;
87 73 }
  @@ -93,20 +79,19 @@
93 79
94 80 String zName = pAttribute.getName();
95 81
96 - if ( pAttribute.isVirtual() )
97 - {
82 + if ( pAttribute.isVirtual() ) {
98 83 addNotes( zNotes );
99 84 addAbstractMethodPublic( zSimpleDataType, "get" + zName );
100 85
101 86 Mutability zMutability = pAttribute.getMutability();
102 87
103 - if ( !Mutability.RO.equals( zMutability ) )
104 - {
88 + if ( !Mutability.RO.equals( zMutability ) ) {
105 89 addBlankLine();
106 90 addNotes( zNotes );
107 91 addMethodPublic( "void", "set" + zName, zSimpleDataType + " p" + zName );
108 92 addLine( "VoAttribute<" + mVoAttributeGenericType + "> zAttribute = getVoAttribute( a" + zName + " );" );
109 - addLine( "if ( verifyMutabilityOnChange( zAttribute, get" + zName + "(), p" + zName + " = zAttribute.normalize( p" + zName + ", zAttribute.isRequired() ) ) )" );
93 + addLine( "if ( verifyMutabilityOnChange( zAttribute, get" + zName + "(), p" + zName + " = zAttribute.normalize( p" + zName +
94 + ", zAttribute.isRequired() ) ) )" );
110 95 addBlockStart();
111 96 addLine( "LLset" + zName + "( p" + zName + " );" );
112 97 addBlockEnd();
  @@ -115,16 +100,13 @@
115 100 addNotes( zNotes );
116 101 addAbstractMethodProtected( "void", "LLset" + zName, zSimpleDataType + " p" + zName );
117 102 }
118 - }
119 - else
120 - {
103 + } else {
121 104 addLine( "private " + zSimpleDataType + " m" + zName + ";" );
122 105
123 106 addBlankLine();
124 107
125 108 addNotes( zNotes );
126 - if ( "ID".equals( zName ) )
127 - {
109 + if ( "ID".equals( zName ) ) {
128 110 addLine( "@Override" );
129 111 }
130 112 addMethodPublic( zSimpleDataType, "get" + zName );
  @@ -132,13 +114,13 @@
132 114 addMethodEnd();
133 115
134 116 addNotes( zNotes );
135 - if ( "ID".equals( zName ) )
136 - {
117 + if ( "ID".equals( zName ) ) {
137 118 addLine( "@Override" );
138 119 }
139 120 addMethodPublic( "void", "set" + zName, zSimpleDataType + " p" + zName );
140 121 addLine( "VoAttribute<" + mVoAttributeGenericType + "> zAttribute = getVoAttribute( a" + zName + " );" );
141 - addLine( "if ( verifyMutabilityOnChange( zAttribute, get" + zName + "(), p" + zName + " = zAttribute.normalize( p" + zName + ", zAttribute.isRequired() ) ) )" );
122 + addLine( "if ( verifyMutabilityOnChange( zAttribute, get" + zName + "(), p" + zName + " = zAttribute.normalize( p" + zName +
123 + ", zAttribute.isRequired() ) ) )" );
142 124 addBlockStart();
143 125 addLine( "LLset" + zName + "( p" + zName + " );" );
144 126 addBlockEnd();