public static CtField addField(CtClass fieldType, String fieldName, CtClass declaringClass, int modifier, String initializerExpr) throws CannotCompileException {
    """
	Adds a field of the desired type to the declaring class.
	
	@param fieldType
	@param fieldName
	@param declaringClass
	@param modifier
	@return
	@throws CannotCompileException
    """
    CtField field = new CtField( fieldType, decapitalize(fieldName), declaringClass );
    field.setModifiers(modifier);
    
    if(initializerExpr != null)
    {
      declaringClass.addField(field, CtField.Initializer.byExpr(initializerExpr));
    }
    else
    {
      declaringClass.addField(field);
    }
    
    return field;
  }
public static CtField addField(CtClass fieldType, String fieldName, CtClass declaringClass, int modifier, String initializerExpr) throws CannotCompileException
  {
    CtField field = new CtField( fieldType, decapitalize(fieldName), declaringClass );
    field.setModifiers(modifier);
    
    if(initializerExpr != null)
    {
      declaringClass.addField(field, CtField.Initializer.byExpr(initializerExpr));
    }
    else
    {
      declaringClass.addField(field);
    }
    
    return field;
  }
public static CtField addField ( CtClass fieldType , String fieldName , CtClass declaringClass , int modifier , String initializerExpr ) throws CannotCompileException { CtField field = new CtField ( fieldType , decapitalize ( fieldName ) , declaringClass ) ; field . setModifiers ( modifier ) ; if ( initializerExpr != null ) { declaringClass . addField ( field , CtField . Initializer . byExpr ( initializerExpr ) ) ; } else { declaringClass . addField ( field ) ; } return field ; }
Adds a field of the desired type to the declaring class.

@param fieldType
@param fieldName
@param declaringClass
@param modifier
@return
@throws CannotCompileException
Adds a field of the desired type to the declaring class .