code: public static void addMember(TypeDeclaration type, BodyDeclaration decl) {
          List<BodyDeclaration> members = type.getMembers();
          if (members == null) {
              members = new ArrayList<BodyDeclaration>();
              type.setMembers(members);
          }
          members.add(decl);
      }
docs: Adds the given declaration to the specified type. The list of members
  will be initialized if it is <code>null</code>.
  
  @param type
  type declaration
  @param decl
  member declaration