protected void appendSerialNumber ( GenerationContext context , XtendTypeDeclaration source , JvmGenericType target ) { if ( ! isAppendSerialNumbersEnable ( context ) ) { return ; } for ( final JvmField field : target . getDeclaredFields ( ) ) { if ( SERIAL_FIELD_NAME . equals ( field . getSimpleName ( ) ) ) { return ; } } final JvmField field = this . typesFactory . createJvmField ( ) ; field . setSimpleName ( SERIAL_FIELD_NAME ) ; field . setVisibility ( JvmVisibility . PRIVATE ) ; field . setStatic ( true ) ; field . setTransient ( false ) ; field . setVolatile ( false ) ; field . setFinal ( true ) ; target . getMembers ( ) . add ( field ) ; field . setType ( this . typeBuilder . cloneWithProxies ( this . _typeReferenceBuilder . typeRef ( long . class ) ) ) ; final long serial = context . getSerial ( ) ; this . typeBuilder . setInitializer ( field , toStringConcatenation ( serial + "L" ) ) ; //$NON-NLS-1$ appendGeneratedAnnotation ( field , context ) ; this . readAndWriteTracking . markInitialized ( field , null ) ; }
Append the serial number field .